Пример #1
0
        void Awake()
        {
            if (instance == null) instance = this;
            else if (instance != this) Destroy(gameObject);

            DontDestroyOnLoad(gameObject);
            
            MapScript = GetComponent<MapHandler>();
            
            InitLevel();

            setAgents();
        }
Пример #2
0
        void Start()
        {
            circleCollider = GetComponent<CircleCollider2D>();
            rigidB = GetComponent<Rigidbody2D>();
            animator = GetComponent<Animator>();

            horizontalAxeName = "Horizontal";
            verticalAxeName = "Vertical";

            blockingLayer = LayerMask.NameToLayer("Blocking Layer");
            gameHandler = GameObject.FindGameObjectWithTag("MazeCamera").GetComponent<GameHandler>();

        }
Пример #3
0
        // Use this for initialization
        void Start()
        {
            player = GameObject.FindGameObjectWithTag("Player").transform;
            gameHandler = GameObject.FindGameObjectWithTag("MazeCamera").GetComponent<GameHandler>();
            moveSpeed = gameHandler.ghostSpeed;
            angularMoveSpeed = gameHandler.ghostAngularSpeed;

            Vector3 dir = player.position - transform.position;
            Quaternion rotat = Quaternion.LookRotation(dir, Vector3.down);
            float angle = 0;
            if (dir.x > 0) angle = 180 - rotat.eulerAngles.x; //an other method can surely be found
            else angle = rotat.eulerAngles.x;
            lastAngle = angle;
            rotat = Quaternion.Euler(0f, 0f, angle);
            transform.rotation = rotat;

        }
Пример #4
0
 // Use this for initialization
 void Start()
 {
     gameHandler = GameObject.FindGameObjectWithTag("MazeCamera").GetComponent<GameHandler>();
 }
Пример #5
0
 // Use this for initialization
 void Start()
 {
     gameHandler = GameObject.FindGameObjectWithTag("MazeCamera").GetComponent<GameHandler>();
     baseTime = gameHandler.time;
     pauseTime = 0;
 }
Пример #6
0
 private void Awake() => Instance = this;