示例#1
0
 /// <summary>
 /// Grabs various components and inits stuff
 /// </summary>
 public virtual void Setup()
 {
     _character             = this.gameObject.GetComponentInParent <Character>();
     _characterGridMovement = _character?.FindAbility <CharacterGridMovement>();
     _weaponModels          = new List <WeaponModel>();
     foreach (WeaponModel model in _character.gameObject.GetComponentsInChildren <WeaponModel>())
     {
         _weaponModels.Add(model);
     }
     CharacterAnimator = _animator;
     // filler if the WeaponAttachment has not been set
     if (WeaponAttachment == null)
     {
         WeaponAttachment = transform;
     }
     if ((_animator != null) && (AutoIK))
     {
         _weaponIK = _animator.GetComponent <WeaponIK>();
     }
     // we set the initial weapon
     if (InitialWeapon != null)
     {
         ChangeWeapon(InitialWeapon, InitialWeapon.WeaponName, false);
     }
 }
        /// <summary>
        /// On start we grab our character movement component and pick a random direction
        /// </summary>
        protected override void Initialization()
        {
            _characterGridMovement = this.gameObject.GetComponentInParent <Character>()?.FindAbility <CharacterGridMovement>();
            _topDownController     = this.gameObject.GetComponentInParent <TopDownController>();
            _collider   = this.gameObject.GetComponentInParent <Collider>();
            _collider2D = this.gameObject.GetComponentInParent <Collider2D>();

            _raycastDirections2D = new[] { Vector2.right, Vector2.left, Vector2.up, Vector2.down };
            _raycastDirections3D = new[] { Vector3.left, Vector3.right, Vector3.forward, Vector3.back };

            PickNewDirection();
        }
示例#3
0
 /// <summary>
 /// Grabs various components and inits stuff
 /// </summary>
 public virtual void Setup()
 {
     _character             = this.gameObject.MMGetComponentNoAlloc <Character>();
     _characterGridMovement = this.gameObject.GetComponent <CharacterGridMovement>();
     CharacterAnimator      = _animator;
     // filler if the WeaponAttachment has not been set
     if (WeaponAttachment == null)
     {
         WeaponAttachment = transform;
     }
     if ((_animator != null) && (AutoIK))
     {
         _weaponIK = _animator.GetComponent <WeaponIK>();
     }
     // we set the initial weapon
     if (InitialWeapon != null)
     {
         ChangeWeapon(InitialWeapon, null);
     }
 }