示例#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");
            }
        }
示例#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]);
        }
 void OnDisable()
 {
     instance = null;
 }
 //singleton logic;
 void OnEnable()
 {
     instance = this;
 }
示例#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>();
 }
示例#8
0
 public Player()
 {
     gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>();
 }