Skip to content

Instantly share code, notes, and snippets.

@giljr
Created March 4, 2018 02:06
Show Gist options
  • Save giljr/339e2ca283e092e0063bfd5b372f9d3d to your computer and use it in GitHub Desktop.
Save giljr/339e2ca283e092e0063bfd5b372f9d3d to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Soldier : MonoBehaviour {
private GameObject mEnemy;
// Use this for initialization
void Start () {
//Move to the left
mEnemy = transform.GetChild(0).gameObject;
//Get enemy position and use trig function to move it
Vector3 enemyPos = mEnemy.transform.position;
enemyPos.z += Mathf.Cos(0.1f);
iTween.MoveTo(mEnemy, enemyPos, 2.0f);
}
// Update is called once per frame
void Update () {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment