Example #1
0
    private static int set_ActionFinish(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            AnimationEventReceiver animationEventReceiver = (AnimationEventReceiver)obj;
            LuaTypes     luaTypes = LuaDLL.lua_type(L, 2);
            Action <int> actionFinish;
            if (luaTypes != LuaTypes.LUA_TFUNCTION)
            {
                actionFinish = (Action <int>)ToLua.CheckObject(L, 2, typeof(Action <int>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 2);
                actionFinish = (DelegateFactory.CreateDelegate(typeof(Action <int>), func) as Action <int>);
            }
            animationEventReceiver.ActionFinish = actionFinish;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index ActionFinish on a nil value");
        }
        return(result);
    }
Example #2
0
        /// <summary>
        /// Start
        /// </summary>
        public override void Start()
        {
            foreach (Transform child in BattleGlobal.instance.bulletArea)
            {
                Destroy(child.gameObject);
            }
            foreach (Transform child in BattleGlobal.instance.fvAttackArea)
            {
                Destroy(child.gameObject);
            }

            this.scene.turret.EndLaserBeamAnimation();

            var userData = BattleGlobal.instance.userData as SingleBattleUserData;
            float hpRemain = (float)userData.hp / userData.maxHp;
            var clearRank = this.GetClearRank(hpRemain);
            var clearResult = hpRemain > 0f ? SinglePlayApi.ClearResult.Cleared : SinglePlayApi.ClearResult.Failed;

            //防衛成功
            if (clearResult == SinglePlayApi.ClearResult.Cleared)
            {
                this.endAnim = Instantiate(this.clearAnimPrefab, this.scene.animationEffectArea, false);
            }
            //防衛失敗
            else
            {
                this.endAnim = Instantiate(this.faildAnimPrefab, this.scene.animationEffectArea, false);
            }

            //アニメ中画面触れないようにしておく
            SharedUI.Instance.DisableTouch();

            //アニメ終わったら
            this.endAnim.onFinished = (tag) =>
            {
                SharedUI.Instance.EnableTouch();

                //バトル終了通信
                SinglePlayApi.CallClearApi(clearResult, clearRank, (response) =>
                {
                    if (clearResult == SinglePlayApi.ClearResult.Cleared)
                    {
                        //リザルト後、ステージセレクトへ戻る
                        SingleBattleResultPopupContent.Open(
                            this.resultPopupContentPrefab,
                            this.scene.stageData,
                            response,
                            clearRank,
                            this.scene.ChangeSceneToSingleStageSelect
                        );
                    }
                    else
                    {
                        //すぐステージセレクトへ戻る
                        this.scene.ChangeSceneToSingleStageSelect();
                    }
                });
            };
        }
Example #3
0
        private void Start() // TODO: может awake?
        {
            _attackTargets.LogIfNull(nameof(_attackTargets));
            _rocketsPool.LogIfNull(nameof(_rocketsPool));

            _pathFollower           = GetComponent <PathFollower>();
            _animationEventReceiver = GetComponent <AnimationEventReceiver>();
        }
        public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex,
                                          AnimatorControllerPlayable controller)
        {
            base.OnStateEnter(animator, stateInfo, layerIndex, controller);

            Debug.Log("State machine enter: " + tag);
            receiver = animator.gameObject.GetComponent <AnimationEventReceiver>();
            if (receiver)
            {
                receiver.StateEnterEvent(tag);
            }
        }
Example #5
0
 public void SetAvatar(GameObject go, bool click = true, bool rotate = false)
 {
     this.avatar          = go.transform;
     this.canClick        = click;
     this.canRotate       = rotate;
     this.ani             = go.transform.GetComponent <Animator>();
     this.aniEventReceier = go.transform.GetComponent <AnimationEventReceiver>();
     if (this.canClick)
     {
         AnimationEventReceiver expr_4D = this.aniEventReceier;
         expr_4D.ActionFinish = (Action <int>)Delegate.Combine(expr_4D.ActionFinish, new Action <int>(this.ActionFinished));
     }
 }
Example #6
0
    private static int OnAttackFinished(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 2);
            AnimationEventReceiver animationEventReceiver = (AnimationEventReceiver)ToLua.CheckObject(L, 1, typeof(AnimationEventReceiver));
            int actionState = (int)LuaDLL.luaL_checknumber(L, 2);
            animationEventReceiver.OnAttackFinished(actionState);
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Example #7
0
    private static int get_ActionFinish(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            AnimationEventReceiver animationEventReceiver = (AnimationEventReceiver)obj;
            Action <int>           actionFinish           = animationEventReceiver.ActionFinish;
            ToLua.Push(L, actionFinish);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index ActionFinish on a nil value");
        }
        return(result);
    }