示例#1
0
    // Start is called before the first frame update
    void Start()
    {
        if (Singleton == null)
        {
            Singleton = this;
        }

        if (Singleton != this)
        {
            Destroy(this);
        }
        player = Player.player;
    }
示例#2
0
 void Awake()
 {
     //makes it a singleton
     if (cameraTracking == null)
     {
         //DontDestroyOnLoad(gameObject);
         cameraTracking = this;
     }
     else if (cameraTracking != this)
     {
         Destroy(gameObject);
     }
 }
示例#3
0
 void Awake()
 {
     cameraTracking    = FindObjectOfType <CameraTracking>();
     magnitude         = 0f;
     curMat            = BlockMaterial.Wood;
     respawnTimerReset = respawnTimer;
     originalScale     = this.transform.localScale;
     rgbdy             = this.gameObject.GetComponent <Rigidbody>();
     //state machine init
     machine    = new PlayerStateMachine();
     doState    = new state[] { Idle, Moving, InAir, Jump, Attack, Hit, Dead };
     invunTimer = 0;
 }
示例#4
0
    public CameraInputController()
    {
        canvas = Resources.FindObjectsOfTypeAll <Canvas>().First(x => x.name == "CameraCanvas");
        if (canvas == null)
        {
            Debug.Log("camera canvas is null");
        }

        cameraTrackingScript = canvas.GetComponentInChildren <CameraTracking>();

        cameraTrackingScript.enabled = true;
        canvas.gameObject.SetActive(true);
        //canvas.enabled = true;
        if (cameraTrackingScript == null)
        {
            Debug.Log("cameraTracking is null");
        }
    }
示例#5
0
    public void Awake()
    {
        colHandler      = this.gameObject.GetComponent <Platform_CollisionHandler>();
        inputController = this.gameObject.GetComponent <Platform_Input_Controller>();


        this.rb      = this.GetComponent <Rigidbody>();
        this.myTrans = gameObject.transform;
        this.hp      = this.lvl * this.baseHP;
        this.mp      = this.lvl * this.baseMp;
        this.mhp     = this.hp;
        this.mmp     = this.mp;

        this.initPos = gameObject.transform.position;



        if (this.cam == null)
        {
            this.cam = Camera.main.GetComponent <CameraTracking>();
        }
    }
示例#6
0
 void Awake()
 {
     cameraScript = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraTracking> ();
 }
示例#7
0
 void Awake()
 {
     anims        = GetComponentsInChildren <Animator> ();
     player       = GameObject.FindGameObjectWithTag("Player");
     cameraScript = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraTracking> ();
 }