Exemplo n.º 1
0
        void Start()
        {
            var gameControllerObject = GameObject.FindGameObjectWithTag("GameController");

            if (gameControllerObject != null)
            {
                _gameControllerObject = gameControllerObject.GetComponent<GameController>();
            }
            if (_gameControllerObject == null)
            {
                Debug.Log("Cannot find 'GameController' script");
            }
        }
Exemplo n.º 2
0
        void Start()
        {
            float t = 0;

            var gameControllerObject = GameObject.FindGameObjectWithTag("GameController");

            if (gameControllerObject != null)
            {
                _gameControllerObject = gameControllerObject.GetComponent<GameController>();
            }
            if (_gameControllerObject == null)
            {
                Debug.Log("Cannot find 'GameController' script");
            }

            Spline = new Spline();
            var random = new System.Random();
            var splineNumber = random.Next(1, 3);
            float offset = 0
                ;
            if (gameObject.tag == "EnemyRed")
            {
                splineNumber = 0;
                offset = 0.5f;
            }
            var path = ITweenPathGameObjects[splineNumber].GetComponent<iTweenPath>();

            Spline.AddKeyframe(-1, path.nodes[0]);

            foreach (var vector3 in path.nodes)
            {
                Spline.AddKeyframe(t++, vector3);
            }
            var vector = path.nodes[path.nodes.Count - 1];
            if (_gameControllerObject != null && _gameControllerObject.Positions != null && _gameControllerObject.Positions[splineNumber].Count > 0)
            {
                var pos = _gameControllerObject.Positions[splineNumber].Pop();
                vector.x += (pos + (pos * offset));
            }

            Spline.AddKeyframe(t++, vector);

            Spline.AddKeyframe(t, path.nodes[path.nodes.Count - 1]);
        }
Exemplo n.º 3
0
 void OnDisable()
 {
     instance = null;
 }
Exemplo n.º 4
0
 //singleton logic;
 void OnEnable()
 {
     instance = this;
 }
Exemplo n.º 5
0
 void Initialization()
 {
     _gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameController>();
 }
 void Awake()
 {
     _controller = GetComponent <GameController>();
     //When the player presses enter, whatever is in the text filed will be sent to the log file
     InputField.onEndEdit.AddListener(AcceptStringInput);
 }
 private void Start()
 {
     _game = FindObjectOfType <GameController>();
 }
Exemplo n.º 8
0
 public Player()
 {
     gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>();
 }