コード例 #1
0
 /// <summary>
 /// On Init we grab our character
 /// </summary>
 public override void Initialization()
 {
     _character     = this.gameObject.GetComponent <Character>();
     _orientation2D = this.gameObject.GetComponent <CharacterOrientation2D>();
     _gizmosColor.a = 0.25f;
     _init          = true;
 }
コード例 #2
0
        protected override void Initialization()
        {
            _character     = GetComponent <Character>();
            _orientation2D = GetComponent <CharacterOrientation2D>();

            animationTime = aoeProjectile.GetComponent <delayedAoE>().animationDelay;
        }
コード例 #3
0
 /// <summary>
 /// On init we grab our Character component
 /// </summary>
 public override void Initialization()
 {
     _character     = this.gameObject.GetComponentInParent <Character>();
     _orientation2D = _character?.FindAbility <CharacterOrientation2D>();
     _collider      = this.gameObject.GetComponentInParent <Collider2D>();
     _gizmoColor.a  = 0.25f;
     _init          = true;
 }
コード例 #4
0
ファイル: WeaponAutoAim2D.cs プロジェクト: leonidas192/Iseng
 /// <summary>
 /// On init we grab our orientation to be able to detect facing direction
 /// </summary>
 protected override void Initialization()
 {
     base.Initialization();
     _orientation2D              = _weapon.Owner.GetComponent <Character>()?.FindAbility <CharacterOrientation2D>();
     _contactFilter              = new ContactFilter2D();
     _contactFilter.layerMask    = TargetsMask;
     _contactFilter.useLayerMask = true;
     _detectionColliders         = new List <Collider2D>();
     _initialized = true;
 }
コード例 #5
0
 /// <summary>
 /// On init we grab all the components we'll need
 /// </summary>
 protected override void Initialization()
 {
     _controller        = this.gameObject.GetComponentInParent <TopDownController>();
     _character         = this.gameObject.GetComponentInParent <Character>();
     _orientation2D     = _character?.FindAbility <CharacterOrientation2D>();
     _characterMovement = _character?.FindAbility <CharacterMovement>();
     _health            = _character?._health;
     _mmPath            = this.gameObject.GetComponentInParent <MMPath>();
     // initialize the start position
     _startPosition = transform.position;
     // initialize the direction
     _direction      = _orientation2D.IsFacingRight ? Vector2.right : Vector2.left;
     _initialScale   = transform.localScale;
     _currentIndex   = 0;
     _indexLastFrame = -1;
     _waitingDelay   = 0;
     _initialized    = true;
 }
コード例 #6
0
        /// <summary>
        /// Returns true if the Brain's Target is facing us (this will require that the Target has a Character component)
        /// </summary>
        /// <returns></returns>
        protected virtual bool EvaluateTargetFacingDirection()
        {
            if (_brain.Target == null)
            {
                return(false);
            }

            _orientation2D = _brain.Target.gameObject.GetComponent <Character>()?.FindAbility <CharacterOrientation2D>();
            if (_orientation2D != null)
            {
                if (_orientation2D.IsFacingRight && (this.transform.position.x > _orientation2D.transform.position.x))
                {
                    return(true);
                }
                if (!_orientation2D.IsFacingRight && (this.transform.position.x < _orientation2D.transform.position.x))
                {
                    return(true);
                }
            }

            return(false);
        }
コード例 #7
0
 /// <summary>
 /// On init we grab our CharacterHandleWeapon ability
 /// </summary>
 protected override void Initialization()
 {
     _character             = GetComponentInParent <Character>();
     _orientation2D         = _character?.FindAbility <CharacterOrientation2D>();
     _characterHandleWeapon = _character?.FindAbility <CharacterHandleWeapon>();
 }
コード例 #8
0
 /// <summary>
 /// On init we grab our CharacterHandleWeapon ability
 /// </summary>
 protected override void Initialization()
 {
     _character             = GetComponent <Character>();
     _orientation2D         = GetComponent <CharacterOrientation2D>();
     _characterHandleWeapon = this.gameObject.GetComponent <CharacterHandleWeapon>();
 }