Beispiel #1
0
        public override void SetDefaultBulletSetting(Unit _owner)
        {
            owner = _owner;

            transform.position = owner.transform.position;
            moveDir            = owner.targetDir;
            targetDir          = owner.targetDir;
            force = owner.force;

            System.Type targetType;
            if (force == EForce.A)
            {
                targetType = typeof(Enemy);
            }
            else
            {
                targetType = typeof(Player);
            }

            TrgCollision trgCol = new TrgCollision(this, targetType);

            new ActDealDamage(trgCol, damage);
            new ActDestroyActor(trgCol, this);
            new ActCreateObjectDynamic(trgCol, EResourceName.Effect_BulletSpark.ToString(), transform);
        }
Beispiel #2
0
        protected override void ActionProcess(Trigger trigger)
        {
            TrgCollision trgCol = trigger as TrgCollision;

            if (trgCol == null)
            {
                return;
            }

            if (trgCol.target == null)
            {
                return;
            }

            Unit targetUnit = trgCol.target as Unit;

            if (targetUnit == null)
            {
                return;
            }

            if (targetUnit.unitStatus == null)
            {
                return;
            }

            if (targetUnit.TryGetOperable(out ShieldOwnable shield) &&
                shield.enableShield)
            {
                shield.ShieldBreak();
            }
Beispiel #3
0
        protected virtual void SetTriggerAction()
        {
            for (int i = 0; i < bounceTriggerList.Count; ++i)
            {
                Trigger trigger = null;
                switch (bounceTriggerList[i])
                {
                case EBounceTrigger.BOUNDARY_TOUCH:
                    trigger = new TrgBoundaryTouch(owner);
                    break;

                case EBounceTrigger.BOUNDARY_OUT:
                    trigger = new TrgBoundaryOut(owner);
                    break;

                case EBounceTrigger.COLLISION:
                    trigger = new TrgCollision(owner, typeof(Unit));
                    break;
                }

                if (trigger == null)
                {
                    return;
                }

                new CndEnable(trigger, enableBounce);

                switch (bounceActionList[i])
                {
                case EBounceAction.REVERSE:
                    new ActTurnReverse(trigger);
                    break;

                case EBounceAction.REFLECT:
                    new ActTurnReflect(trigger);
                    break;

                case EBounceAction.TARGET:
                    new ActTurnTarget(trigger);
                    break;

                case EBounceAction.BLOCK:
                    new ActBlockMove(trigger);
                    break;

                case EBounceAction.DESTROY:
                    new ActDestroyActor(trigger, owner);
                    break;
                }
            }
        }
Beispiel #4
0
        public virtual void SetDefaultBulletSetting(Unit _owner)
        {
            owner = _owner;

            transform.position = owner.transform.position;
            moveDir            = owner.targetDir;
            targetDir          = owner.targetDir;
            force = owner.force;

            System.Type targetType;
            if (force == EForce.A)
            {
                targetType = typeof(Enemy);
            }
            else
            {
                targetType = typeof(Player);
            }

            TrgCollision trgCol = new TrgCollision(this, targetType);

            new ActDealDamage(trgCol, damage);
            new ActDestroyActor(trgCol, this);
        }
Beispiel #5
0
 public ActDealDamage(TrgCollision trigger, int _damage)
     : base(trigger)
 {
     damage = _damage;
 }
Beispiel #6
0
 public ActActivateTargetOperable(TrgCollision trigger,
                                  MultiState.EStateType _type, bool _doActive)
     : base(trigger, _type, _doActive)
 {
 }
Beispiel #7
0
        public override void Init()
        {
            base.Init();

            GetOperable <Movable>().speed = _speed;

            // 플레이어 이동, 회전 처리
            TrgKeyInputs triKeyInput = new TrgKeyInputs(this);

            new ActVectorMoveActor(triKeyInput, 2f);

            BooleanWrapper doTrackMouse = new BooleanWrapper(true);
            TrgFrame       TrgAlways    = new TrgFrame(this, 0);

            new CndEnable(TrgAlways, doTrackMouse);
            new ActDirectionToMouse(TrgAlways, this);

            // 플레이어 공격 처리
            GetOperable <Shootable>().state.SetState(MultiState.EStateType.CLICK, false);

            TrgKeyInput triMouseDown = new TrgKeyInput(
                this, KeyManager.EKeyCommand.COMMAND_ATTACK, KeyManager.EKeyPressType.DOWN);

            new ActActivateOperable <Shootable>(triMouseDown, MultiState.EStateType.CLICK, true);

            TrgKeyInput triMouseUp = new TrgKeyInput(
                this, KeyManager.EKeyCommand.COMMAND_ATTACK, KeyManager.EKeyPressType.UP);

            new ActActivateOperable <Shootable>(triMouseUp, MultiState.EStateType.CLICK, false);

            // 플레이어 피격 처리
            float knockbackTime = 0.38f;
            float dodgeTime     = 1.3f;

            TrgCollision triCol = new TrgCollision(this, typeof(Bullet), typeof(Enemy));

            new ActInitTrigger(triCol, triKeyInput);

            new ActGetDamage(triCol, 1);

            new ActKnockback(triCol, this, 8f, 20f);
            new ActSetSpeed(triCol, _hitSpeed);
            new ActSetSpeed(triCol, _speed)
            {
                delay = dodgeTime
            };

            new ActActivateOperable <Controllable>(triCol, MultiState.EStateType.KNOCKBACK, true);
            new ActActivateOperable <Controllable>(triCol, MultiState.EStateType.KNOCKBACK, false)
            {
                delay = knockbackTime
            };
            new ActActivateOperable <Collidable>(triCol, MultiState.EStateType.KNOCKBACK, true);
            new ActActivateOperable <Collidable>(triCol, MultiState.EStateType.KNOCKBACK, false)
            {
                delay = dodgeTime
            };
            new ActActivateOperable <Shootable>(triCol, MultiState.EStateType.KNOCKBACK, false);
            new ActActivateOperable <Shootable>(triCol, MultiState.EStateType.KNOCKBACK, true)
            {
                delay = dodgeTime
            };

            SpriteRenderer sprite = GetComponent <SpriteRenderer>();

            new ActSetSpriteColor(triCol, sprite, new Color(1f, 1f, 1f, 0.5f));
            new ActSetSpriteColor(triCol, sprite, new Color(1f, 1f, 1f, 1f))
            {
                delay = dodgeTime
            };
            new ActSetSprite(triCol, sprite,
                             ResourcesManager.LoadResource <Sprite>(EResourceName.Player_Damaged_strip5));
            new ActSetSprite(triCol, sprite,
                             ResourcesManager.LoadResource <Sprite>(EResourceName.Player))
            {
                delay = dodgeTime
            };
            new ActSetController(triCol, gameObject,
                                 ResourcesManager.LoadResource <RuntimeAnimatorController>(
                                     EResourceName.Player_Damaged_Controller));
            new ActSetController(triCol, gameObject, null)
            {
                delay = knockbackTime
            };
            new ActSetAnimatorSpeed(triCol, gameObject, 0.8f);

            new ActSetValue <bool>(triCol, doTrackMouse, false);
            new ActSetValue <bool>(triCol, doTrackMouse, true)
            {
                delay = knockbackTime
            };

            // test code: 키보드 숫자키 클릭 시 작동
            TrgKeyInput trgPress1 = new TrgKeyInput(
                this, KeyManager.EKeyCommand.ITEM_1, KeyManager.EKeyPressType.DOWN);

            new ActSpawnActor(trgPress1, EResourceName.Enemy_Wing);

            TrgKeyInput trgPress2 = new TrgKeyInput(
                this, KeyManager.EKeyCommand.ITEM_2, KeyManager.EKeyPressType.DOWN);

            new ActDestroyRandomRandom(trgPress2);

            TrgKeyInput trgPress3 = new TrgKeyInput(
                this, KeyManager.EKeyCommand.ITEM_3, KeyManager.EKeyPressType.DOWN);

            new ActTest(trgPress3);

            //Pattern_Slayer_1 pattern_S1 = new Pattern_Slayer_1(this);
            //ActionActivatePattern actActivatePattern =
            //    new ActionActivatePattern(trgRightClick, pattern_S1);
        }