示例#1
0
 protected virtual void Start()
 {
     player = FindObjectOfType <StateManager>().gameObject;
     animHook.Initialise(null, this);
     cameraManager = CameraManager.instance;
     currentAttackers.Clear();
 }
示例#2
0
        /// <summary>
        /// Performs set up references for variables needed for class methods.
        /// </summary>
        public void Initialise()
        {
            SetUpAnimator();
            rigidBody             = GetComponent <Rigidbody>();
            rigidBody.angularDrag = 999;
            rigidBody.drag        = 4;
            rigidBody.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;
            animHook             = GetComponentInChildren <AnimatorHook>();
            collider             = GetComponent <Collider>();
            characterAudioSource = GetComponent <AudioSource>();
            shieldAudioSource    = GameObject.Find("Shield").GetComponent <AudioSource>();
            originalSpeed        = moveSpeed;

            if (animHook == false)
            {
                //print("Added AnimatorHook.cs to " + gameObject.name);
                animHook = activeModel.AddComponent <AnimatorHook>();
            }

            animHook.Initialise(this, null);
            actionManager = GetComponent <ActionManager>();
            actionManager.Initialise();
            weaponHook = GetComponentInChildren <WeaponHook>();
            weaponHook.CloseDamageCollider();
            gameObject.layer = 9;          // Set to player layer
            ignoredLayers    = ~(1 << 10); // Ignore layers 1 to 10
        }