Beispiel #1
0
        /// イベントの再生
        public void Play(GameActorProduct trgActor, GameActorEventContainer eveCntr)
        {
            if (eveCntr.Num > 0)
            {
                GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance();

                for (int i = 0; i < eveCntr.Num; i++)
                {
                    GameObjProduct trgObj = eveCntr.GetEntryObj(i);

                    /// ダメージ
                    if (eveCntr.GetEventId(i) == ActorEventId.Damage)
                    {
                        trgActor.SetEventDamage(trgObj, (Data.AttackTypeId)eveCntr.GetEntryAtb(i));
                    }

                    /// エフェクト再生
                    else if (eveCntr.GetEventId(i) == ActorEventId.Effect)
                    {
                        if (trgObj != null)
                        {
                            ctrlResMgr.CtrlEffect.EntryEffect((Data.EffTypeId)eveCntr.GetEntryAtb(i), trgObj);
                        }
                        else
                        {
                            ctrlResMgr.CtrlEffect.EntryEffect((Data.EffTypeId)eveCntr.GetEntryAtb(i), eveCntr.GetTrgPos(i));
                        }
                    }

                    /// 相手の方へ向く
                    else if (eveCntr.GetEventId(i) == ActorEventId.LookTrg)
                    {
                        trgActor.SetLookTrgPos(eveCntr.GetTrgPos(i));
                    }

                    /// 相手の方へ振り向く
                    else if (eveCntr.GetEventId(i) == ActorEventId.TurnTrg)
                    {
                        if (trgObj != null)
                        {
                            trgActor.SetEventTurnPos(new Vector3(trgObj.Mtx.M41, trgObj.Mtx.M42, trgObj.Mtx.M43), eveCntr.GetEntryAtb(i));
                        }
                    }

                    /// スーパーアーマー化
                    else if (eveCntr.GetEventId(i) == ActorEventId.SuperArm)
                    {
                        trgActor.SetEventSuperArm();
                    }

                    /// 動作キャンセル
                    else if (eveCntr.GetEventId(i) == ActorEventId.MvtCancel)
                    {
                        trgActor.SetEventMvtCancel();
                    }
                }
            }

            eveCntr.Clear();
        }
Beispiel #2
0
 /// 終了
 public void End()
 {
     actorStg.End();
     actorDestination.End();
     EventCntr.Clear();
     destinationTrgActor = null;
 }
Beispiel #3
0
 /// クリア
 public void End()
 {
     playId           = 0;
     useActor         = null;
     useInterfereCntr = null;
     useCollMgr       = null;
 }
Beispiel #4
0
        /*
         * public void changeAnimation(bool Flag){
         *      actorCh.changeAnimation(Flag);
         * }
         */


        /// フレーム:目的地への移動FPS視点
        private bool frameDestinationMoveFps()
        {
            GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance();

            float rotY;
            float cal;
            float angleY;

            float mPow = moveSpeed;


            /// 目的地が設定されている場合
            ///----------------------------------------------------
            if (ctrlResMgr.CtrlStg.CheckDestinationTrg())
            {
                float trgDis = Common.VectorUtil.DistanceXZ(actorCh.BasePos, ctrlResMgr.CtrlStg.GetDestinationPos());

                GameActorProduct trgActor = ctrlResMgr.CtrlStg.GetDestinationActor();
                ShapeSphere      bndSph   = trgActor.GetBoundingShape();


                if (mPow > trgDis)
                {
                    mPow = trgDis;
                }

                /// 目的地到着
                if (trgDis <= mPow || (bndSph != null && trgDis <= bndSph.Sphre.R * 1.5f))
                {
                    ctrlResMgr.CtrlStg.ClearDestination();
                    actorCh.SetStateMove(new Vector3(actorCh.BaseMtx.M31, actorCh.BaseMtx.M32, actorCh.BaseMtx.M33), mPow, 0, false);

                    if (bndSph != null)
                    {
                        actorCh.Frame();
                        setPlayMode(PlayModeId.Normal);
                        actorCh.SetStateAttack(0);
                    }
                    return(false);
                }

                actorCh.SetLookTrgPos(ctrlResMgr.CtrlStg.GetDestinationPos());
            }

            /// 直進移動
            ///----------------------------------------------------
            else
            {
                rotY            = 180.0f + ctrlResMgr.CtrlCam.GetCamRotY() + AppInput.GetInstance().GetPlRotY();
                cal             = (float)(3.141593f / 180.0);
                angleY          = rotY * cal;
                actorCh.BaseMtx = Matrix4.RotationY(angleY);
                Common.MatrixUtil.SetTranslate(ref actorCh.BaseMtx, actorCh.BasePos);
                actorCh.SetPlace(actorCh.BaseMtx);
            }

            actorCh.SetStateMove(new Vector3(actorCh.BaseMtx.M31, actorCh.BaseMtx.M32, actorCh.BaseMtx.M33), mPow, 0, false);
            return(true);
        }
        /// 命令:SE再生

        /**
         *  ATB[0]    : SEのNo.
         **/
        private void cmdActSetSePlay(int cmdIdx)
        {
            int seId = usePlayAct.GetAtb(cmdIdx, 0);

            GameActorProduct trgActor = useUnitCmn.GetUseActor();

            AppSound.GetInstance().PlaySeCamDis((AppSound.SeId)seId, trgActor.BasePos);
        }
        /// private メソッド
        ///---------------------------------------------------------------------------
        /// 登録
        public void entryActor( GameActorProduct actor, float dis )
        {
            GameCtrlDrawParam    drawParam = new GameCtrlDrawParam();

            drawParam.Actor     = actor;
            drawParam.Dis       = dis;

            objParamList.Add( drawParam );
        }
Beispiel #7
0
        /// OBJの登録
        public bool Add(GameActorProduct parent, GameObjProduct obj)
        {
            objParamList.Add(new ActorUnitCollObjParam());

            objParamList[(objParamList.Count - 1)].ObjParent = parent;
            objParamList[(objParamList.Count - 1)].Obj       = obj;

            return(true);
        }
        /// OBJの登録
        public bool Add( GameActorProduct parent, GameObjProduct obj )
        {
            objParamList.Add( new ActorUnitCollObjParam() );

            objParamList[(objParamList.Count-1)].ObjParent    = parent;
            objParamList[(objParamList.Count-1)].Obj          = obj;

            return true;
        }
        /// 命令:エフェクト再生

        /**
         *  ATB[0]    : EffのNo.
         *  ATB[1]    : くっつける対象のOBJのIndex
         **/
        private void cmdActSetEffPlay(int cmdIdx)
        {
            int effId  = usePlayAct.GetAtb(cmdIdx, 0);
            int objIdx = usePlayAct.GetAtb(cmdIdx, 1);

            GameActorProduct trgActor = useUnitCmn.GetUseActor();

            trgActor.EventCntr.Add(ActorEventId.Effect, effId, trgActor.GetUseObj(objIdx));
        }
Beispiel #10
0
        /// キャラクタの登録
        public void EntryCharacter(GameActorProduct actor, bool cullingFlg)
        {
            ShapeSphere bndSph = actor.GetBoundingShape();

            if (cullingFlg == false || cullingShape.CheckNearDis(bndSph.Sphre.Pos) < bndSph.Sphre.R)
            {
                float dis = Common.VectorUtil.Distance(actor.BasePos, GameCtrlManager.GetInstance().CtrlCam.GetCamPos());
                entryActor(actor, dis);
            }
        }
Beispiel #11
0
/// private メソッド
///---------------------------------------------------------------------------

        /// 登録
        public void entryActor(GameActorProduct actor, float dis)
        {
            GameCtrlDrawParam drawParam = new GameCtrlDrawParam();


            drawParam.Actor = actor;
            drawParam.Dis   = dis;

            objParamList.Add(drawParam);
        }
Beispiel #12
0
        /// 破壊対象
        public void setBreakTarget(int scrPosX, int scrPosY)
        {
            GameActorCollManager useCollMgr = actorDestination.GetMoveCollManager();

            Vector3 posStart = new Vector3(0, 0, 0);
            Vector3 posEnd   = new Vector3(0, 0, 0);

            /// チェックする開始座標と終了座標のセット
            ctrlResMgr.GraphDev.GetScreenToWorldPos(scrPosX, scrPosY, 0.0f, ref posStart);
            ctrlResMgr.GraphDev.GetScreenToWorldPos(scrPosX, scrPosY, 1.0f, ref posEnd);


            DemoGame.GeometryLine moveMoveLine = new DemoGame.GeometryLine(posStart, posEnd);

            /// 衝突対象の登録
            useCollMgr.TrgContainer.Clear();

            ctrlResMgr.CtrlHobit.SetDestinationActor(useCollMgr.TrgContainer);
            ctrlResMgr.CtrlTo.SetDestinationActor(useCollMgr.TrgContainer);
            ctrlResMgr.CtrlWall.SetDestinationActor(useCollMgr.TrgContainer);


            /// 衝突判定
            calCollLook.SetMoveType(Data.CollTypeId.ChDestination);

            bool checkBound = calCollLook.Check(useCollMgr, moveMoveLine);

            if (checkBound)
            {
                /// マーカーのセット
                destinationTrgActor = useCollMgr.TrgContainer.GetEntryObjParent(0);
                destinationTrgActor.SetDeadFlag();
                if (destinationTrgActor.CheckMoveTrgId() == 1)
                {
                    TouchPostion = destinationTrgActor.BasePos;
                    destinationTrgActor.SetDeadFlag();
                }
                else if (destinationTrgActor.CheckMoveTrgId() == 2)
                {
                    TouchPostion = destinationTrgActor.BasePos;
                    destinationTrgActor.SetDeadFlag();
                }
                else if (destinationTrgActor.CheckMoveTrgId() == 3)
                {
                    TouchPostion = destinationTrgActor.BasePos;
                    destinationTrgActor.SetDeadFlag();
                }
                else
                {
                    TouchPostion = calCollLook.NextPos;
                }
            }
        }
Beispiel #13
0
        /// イベントの再生
        public void Play( GameActorProduct trgActor, GameActorEventContainer eveCntr )
        {
            if( eveCntr.Num > 0 ){

            GameCtrlManager        ctrlResMgr    = GameCtrlManager.GetInstance();

            for( int i=0; i<eveCntr.Num; i++ ){

                GameObjProduct trgObj = eveCntr.GetEntryObj( i );

                /// ダメージ
                if( eveCntr.GetEventId( i ) == ActorEventId.Damage ){
                    trgActor.SetEventDamage( trgObj, (Data.AttackTypeId)eveCntr.GetEntryAtb( i ) );
                }

                /// エフェクト再生
                else if( eveCntr.GetEventId( i ) == ActorEventId.Effect ){
                    if( trgObj != null ){
                        ctrlResMgr.CtrlEffect.EntryEffect( (Data.EffTypeId)eveCntr.GetEntryAtb( i ), trgObj );
                    }
                    else{

                        ctrlResMgr.CtrlEffect.EntryEffect( (Data.EffTypeId)eveCntr.GetEntryAtb( i ), eveCntr.GetTrgPos( i ) );
                    }
                }

                /// 相手の方へ向く
                else if( eveCntr.GetEventId( i ) == ActorEventId.LookTrg ){
                    trgActor.SetLookTrgPos( eveCntr.GetTrgPos( i ) );
                }

                /// 相手の方へ振り向く
                else if( eveCntr.GetEventId( i ) == ActorEventId.TurnTrg ){
                    if( trgObj != null ){
                        trgActor.SetEventTurnPos( new Vector3( trgObj.Mtx.M41, trgObj.Mtx.M42, trgObj.Mtx.M43 ), eveCntr.GetEntryAtb( i ) );
                    }
                }

                /// スーパーアーマー化
                else if( eveCntr.GetEventId( i ) == ActorEventId.SuperArm ){
                    trgActor.SetEventSuperArm();
                }

                /// 動作キャンセル
                else if( eveCntr.GetEventId( i ) == ActorEventId.MvtCancel ){
                    trgActor.SetEventMvtCancel();
                }
            }
            }

            eveCntr.Clear();
        }
/// private
///---------------------------------------------------------------------------

        /// 攻撃範囲チェック
        private bool attackAreaCheck(GameActorProduct myActor, GameActorProduct trgActor, float rotR, float rotL, float disArea)
        {
            float dis = Common.VectorUtil.Distance(myActor.BasePos, trgActor.BasePos);

            if (dis <= disArea)
            {
                float rot = Common.MatrixUtil.GetPointRotY(myActor.BaseMtx, myActor.BasePos, trgActor.BasePos);

                if (rot >= rotR && rot <= rotL)
                {
                    return(true);
                }
            }
            return(false);
        }
Beispiel #15
0
        /// 開始
        public void Start(GameActorProduct useActor, GameActorContainer useInterfereCntr, GameActorCollManager useCollMgr)
        {
            basePos = new Vector3(0.0f, 0.0f, 0.0f);
            baseRot = new Vector3(0.0f, 0.0f, 0.0f);

            setMtxRotateEulerXYZ(baseRot);

            Common.MatrixUtil.SetTranslate(ref baseMtx, basePos);

            playId = 0;

            this.useActor         = useActor;
            this.useInterfereCntr = useInterfereCntr;
            this.useCollMgr       = useCollMgr;
        }
Beispiel #16
0
        public void ClearMakeWall()
        {
            towerPos.Xyz  = StaticDataList.getVectorZero();
            effectPos.Xyz = StaticDataList.getVectorZero();
            if (mode == 1)
            {
//			ctrlResMgr.CtrlHobit.SetCtrlStateId(CtrlHobitemy.CtrlStateId.Eat);
//			ctrlResMgr.CtrlCam.SetCamMode( CtrlCamera.ModeId.LookMyself );
            }
            mode                    = 0;
            TouchCount              = 0;
            makeTowerFlag           = true;
            destinationFlg          = false;
            actorDestination.Enable = false;
            destinationTrgActor     = null;
        }
Beispiel #17
0
 /// 破棄
 public void Term()
 {
     if (calCollMove != null)
     {
         calCollMove.Term();
     }
     if (calCollGrav != null)
     {
         calCollGrav.Term();
     }
     calCollGrav      = null;
     calCollMove      = null;
     useCollMgr       = null;
     useActor         = null;
     useInterfereCntr = null;
 }
Beispiel #18
0
        public void findingTower(int scrPosX, int scrPosY)
        {
            GameActorCollManager useCollMgr = actorDestination.GetMoveCollManager();

            Vector3 posStart = new Vector3(0, 0, 0);
            Vector3 posEnd   = new Vector3(0, 0, 0);

            /// チェックする開始座標と終了座標のセット
            ctrlResMgr.GraphDev.GetScreenToWorldPos(scrPosX, scrPosY, 0.0f, ref posStart);
            ctrlResMgr.GraphDev.GetScreenToWorldPos(scrPosX, scrPosY, 1.0f, ref posEnd);


            DemoGame.GeometryLine moveMoveLine = new DemoGame.GeometryLine(posStart, posEnd);

            /// 衝突対象の登録
            useCollMgr.TrgContainer.Clear();

            ctrlResMgr.CtrlTo.SetDestinationActor(useCollMgr.TrgContainer);
            /// 衝突判定
            calCollLook.SetMoveType(Data.CollTypeId.ChDestination);

            bool checkBound = calCollLook.Check(useCollMgr, moveMoveLine);

            if (checkBound)
            {
                destinationTrgActor = useCollMgr.TrgContainer.GetEntryObjParent(0);
                ShapeSphere bndSph = destinationTrgActor.GetBoundingShape();

                if (destinationTrgActor.CheckMoveTrgId() == 2)
                {
                    mode = 2;
                    if (bndSph != null)
                    {
                        TouchPostion = bndSph.Sphre.Pos;
                    }
                    else
                    {
                        TouchPostion = destinationTrgActor.BasePos;
                    }
                }
                else
                {
                    TouchPostion = calCollLook.NextPos;
                }
            }
        }
        /// 命令:攻撃のセット

        /**
         *  ATB[0]    : 攻撃タイプ
         *  ATB[1]    : 攻撃対象との有効角度R
         *  ATB[2]    : 攻撃対象との有効角度L
         *  ATB[3]    : 攻撃対象との有効距離
         **/
        private void cmdActSetAttack(int cmdIdx)
        {
            int   attackType = usePlayAct.GetAtb(cmdIdx, 0);
            float trgRotR    = (float)usePlayAct.GetAtb(cmdIdx, 1);
            float trgRotL    = (float)usePlayAct.GetAtb(cmdIdx, 2);
            float trgDis     = (float)usePlayAct.GetAtb(cmdIdx, 3) / 100.0f;;

            GameActorContainer interfereCntr = useUnitCmn.GetInterfereCntr();
            GameActorProduct   trgActor      = useUnitCmn.GetUseActor();

            /// 攻撃イベントを通達
            for (int i = 0; i < interfereCntr.Num; i++)
            {
                if (interfereCntr.GetActor(i).EventCntr != null)
                {
                    if (attackAreaCheck(trgActor, interfereCntr.GetActor(i), trgRotR, trgRotL, trgDis))
                    {
                        interfereCntr.GetActor(i).EventCntr.Add(ActorEventId.Damage, attackType, trgActor.GetUseObj(0));
                    }
                }
            }
        }
        /// 命令:近くの対象の方向を振り向く

        /**
         *  ATB[0]    : 旋回する対象との有効距離
         *  ATB[1]    : 旋回速度
         **/
        private void cmdActSetTurnNearTrg(int cmdIdx)
        {
            float trgDis = (float)usePlayAct.GetAtb(cmdIdx, 0) / 100.0f;
            int   rotVal = usePlayAct.GetAtb(cmdIdx, 1);

            GameActorContainer interfereCntr = useUnitCmn.GetInterfereCntr();
            GameActorProduct   trgActor      = useUnitCmn.GetUseActor();

            int   bestTrg;
            float dis, disMax;
            bool  entryFlg;

            bestTrg  = -1;
            disMax   = 0.0f;
            entryFlg = false;

            for (int i = 0; i < interfereCntr.Num; i++)
            {
                if (interfereCntr.GetActor(i).EventCntr != null)
                {
                    dis = Common.VectorUtil.Distance(trgActor.BasePos, interfereCntr.GetActor(i).BasePos);

                    if (dis <= trgDis && (entryFlg == false || dis < disMax))
                    {
                        bestTrg  = i;
                        disMax   = dis;
                        entryFlg = true;
                    }
                }
            }

            /// 一番近くの対象の方向へ振り向く
            if (bestTrg >= 0)
            {
                trgActor.EventCntr.Add(ActorEventId.TurnTrg, rotVal, interfereCntr.GetActor(bestTrg).GetUseObj(0));
            }
        }
        /// 命令:アニメーションのセット

        /**
         *  ATB[0]    : 再生するアニメーションNo.
         *  ATB[1]    : アニメーションをループするかのフラグ
         *  ATB[2]    : アクタに含まれる対象Objの登録No.
         **/
        private void cmdActSetAnimation(int cmdIdx)
        {
            int  animNo      = usePlayAct.GetAtb(cmdIdx, 0);
            bool animLoopFlg = (usePlayAct.GetAtb(cmdIdx, 1) == 0)?    false : true;
            int  trgObjId    = usePlayAct.GetAtb(cmdIdx, 2);

            GameActorProduct trgActor = useUnitCmn.GetUseActor();

            if (trgActor.GetUseObjNum() <= 0)
            {
                return;
            }

            Common.ModelHandle mdlHdl = trgActor.GetUseObj(trgObjId).GetModelHdl();
            if (mdlHdl == null)
            {
                return;
            }

            mdlHdl.SetPlayAnim(animNo, animLoopFlg);

            /// アニメーションの長さが終了フレームとする
            actFrameMax = mdlHdl.GetAnimLength();
        }
 /// エフェクトの登録
 public void EntryEffect( GameActorProduct actor, bool cullingFlg )
 {
     float dis = Common.VectorUtil.Distance( actor.BasePos, camPos );
     entryActor( actor, dis );
 }
Beispiel #23
0
 public void Clear()
 {
     Actor = null;
 }
Beispiel #24
0
        /// エフェクトの登録
        public void EntryEffect(GameActorProduct actor, bool cullingFlg)
        {
            float dis = Common.VectorUtil.Distance(actor.BasePos, camPos);

            entryActor(actor, dis);
        }
        /// 命令:スーパーアーマー化

        /**
        **/
        private void cmdActSetSuperArm(int cmdIdx)
        {
            GameActorProduct trgActor = useUnitCmn.GetUseActor();

            trgActor.EventCntr.Add(ActorEventId.SuperArm, 0, null);
        }
        /// 命令:動作キャンセル受付

        /**
        **/
        private void cmdActSetMvtCancel(int cmdIdx)
        {
            GameActorProduct trgActor = useUnitCmn.GetUseActor();

            trgActor.EventCntr.Add(ActorEventId.MvtCancel, 0, null);
        }
Beispiel #27
0
 /// 終了
 public void End()
 {
     actorStg.End();
     actorDestination.End();
     EventCntr.Clear();
     destinationTrgActor = null;
 }
 public void Clear()
 {
     Actor    = null;
 }
Beispiel #29
0
        /// private メソッド
        ///---------------------------------------------------------------------------
        /// 目的地セット
        public void setDestination( int scrPosX, int scrPosY )
        {
            GameActorCollManager       useCollMgr    = actorDestination.GetMoveCollManager();

            Vector3 posStart = new Vector3(0,0,0);
            Vector3 posEnd = new Vector3(0,0,0);

            /// チェックする開始座標と終了座標のセット
            ctrlResMgr.GraphDev.GetScreenToWorldPos( scrPosX, scrPosY, 0.0f, ref posStart );
            ctrlResMgr.GraphDev.GetScreenToWorldPos( scrPosX, scrPosY, 1.0f, ref posEnd );

            DemoGame.GeometryLine moveMoveLine = new DemoGame.GeometryLine( posStart, posEnd );

            /// 衝突対象の登録
            useCollMgr.TrgContainer.Clear();

            ctrlResMgr.CtrlHobit.SetDestinationActor( useCollMgr.TrgContainer );
            ctrlResMgr.CtrlTo.SetDestinationActor( useCollMgr.TrgContainer );
            ctrlResMgr.CtrlWall.SetDestinationActor( useCollMgr.TrgContainer );
            useCollMgr.TrgContainer.Add( actorStg, actorStg.GetUseObj(0) );

            /// 衝突判定
            calCollLook.SetMoveType( Data.CollTypeId.ChDestination );

            bool checkBound = calCollLook.Check( useCollMgr, moveMoveLine );

            if( checkBound ){
            /// マーカーのセット
            actorDestination.Start();

            Matrix4 mtx = Matrix4.RotationY( 0 );

            destinationTrgActor = useCollMgr.TrgContainer.GetEntryObjParent(0);
            ShapeSphere bndSph  = destinationTrgActor.GetBoundingShape();

            if( destinationTrgActor.CheckMoveTrgId() == 1 ){
                if( bndSph != null ){
                    destinationPos = bndSph.Sphre.Pos;
                }
                else{
                    destinationPos = destinationTrgActor.BasePos;
                }
                actorDestination.SetType( 0 );
            }
            else if( destinationTrgActor.CheckMoveTrgId() == 2 ){
                destinationPos = destinationTrgActor.BasePos;
                if( bndSph != null ){
                    destinationPos.Y += bndSph.Sphre.R;
                }
                actorDestination.SetType( 0 );
            }
            else{
                destinationPos = calCollLook.NextPos;
                destinationPos.Y += 0.02f;
                actorDestination.SetType( 1 );
            }

            Common.MatrixUtil.SetTranslate( ref mtx, destinationPos );
            actorDestination.SetPlace( mtx );

            actorDestination.Enable = true;
            }
            else{
            actorDestination.Enable = false;
            }
        }
 /// イベントの登録
 public bool Add( GameActorProduct actor )
 {
     actorList.Add( actor );
     return true;
 }
 /// クリア
 public void End()
 {
     playId              = 0;
     useActor            = null;
     useInterfereCntr    = null;
     useCollMgr          = null;
 }
Beispiel #32
0
/// private メソッド
///---------------------------------------------------------------------------

        /// 目的地セット
        public void setDestination(int scrPosX, int scrPosY)
        {
            GameActorCollManager useCollMgr = actorDestination.GetMoveCollManager();

            Vector3 posStart = new Vector3(0, 0, 0);
            Vector3 posEnd   = new Vector3(0, 0, 0);

            /// チェックする開始座標と終了座標のセット
            ctrlResMgr.GraphDev.GetScreenToWorldPos(scrPosX, scrPosY, 0.0f, ref posStart);
            ctrlResMgr.GraphDev.GetScreenToWorldPos(scrPosX, scrPosY, 1.0f, ref posEnd);


            DemoGame.GeometryLine moveMoveLine = new DemoGame.GeometryLine(posStart, posEnd);

            /// 衝突対象の登録
            useCollMgr.TrgContainer.Clear();

            ctrlResMgr.CtrlHobit.SetDestinationActor(useCollMgr.TrgContainer);
            ctrlResMgr.CtrlTo.SetDestinationActor(useCollMgr.TrgContainer);
            ctrlResMgr.CtrlWall.SetDestinationActor(useCollMgr.TrgContainer);
            useCollMgr.TrgContainer.Add(actorStg, actorStg.GetUseObj(0));


            /// 衝突判定
            calCollLook.SetMoveType(Data.CollTypeId.ChDestination);

            bool checkBound = calCollLook.Check(useCollMgr, moveMoveLine);

            if (checkBound)
            {
                /// マーカーのセット
                actorDestination.Start();

                Matrix4 mtx = Matrix4.RotationY(0);

                destinationTrgActor = useCollMgr.TrgContainer.GetEntryObjParent(0);
                ShapeSphere bndSph = destinationTrgActor.GetBoundingShape();

                if (destinationTrgActor.CheckMoveTrgId() == 1)
                {
                    if (bndSph != null)
                    {
                        destinationPos = bndSph.Sphre.Pos;
                    }
                    else
                    {
                        destinationPos = destinationTrgActor.BasePos;
                    }
                    actorDestination.SetType(0);
                }
                else if (destinationTrgActor.CheckMoveTrgId() == 2)
                {
                    destinationPos = destinationTrgActor.BasePos;
                    if (bndSph != null)
                    {
                        destinationPos.Y += bndSph.Sphre.R;
                    }
                    actorDestination.SetType(0);
                }
                else
                {
                    destinationPos    = calCollLook.NextPos;
                    destinationPos.Y += 0.02f;
                    actorDestination.SetType(1);
                }

                Common.MatrixUtil.SetTranslate(ref mtx, destinationPos);
                actorDestination.SetPlace(mtx);

                actorDestination.Enable = true;
            }
            else
            {
                actorDestination.Enable = false;
            }
        }
 /// 破棄
 public void Term()
 {
     if( calCollMove != null ){
     calCollMove.Term();
     }
     if( calCollGrav != null ){
     calCollGrav.Term();
     }
     calCollGrav         = null;
     calCollMove         = null;
     useCollMgr          = null;
     useActor            = null;
     useInterfereCntr    = null;
 }
        /// 開始
        public void Start( GameActorProduct useActor, GameActorContainer useInterfereCntr, GameActorCollManager useCollMgr )
        {
            basePos        = new Vector3( 0.0f, 0.0f, 0.0f );
            baseRot        = new Vector3( 0.0f, 0.0f, 0.0f );

            setMtxRotateEulerXYZ( baseRot );

            Common.MatrixUtil.SetTranslate( ref baseMtx, basePos );

            playId        = 0;

            this.useActor            = useActor;
            this.useInterfereCntr    = useInterfereCntr;
            this.useCollMgr          = useCollMgr;
        }
Beispiel #35
0
 /// 目的地クリア
 public void ClearDestination()
 {
     destinationFlg          = false;
     actorDestination.Enable = false;
     destinationTrgActor     = null;
 }
Beispiel #36
0
 public void Clear()
 {
     Obj       = null;
     ObjParent = null;
     CollFlg   = false;
 }
Beispiel #37
0
 /// 目的地クリア
 public void ClearDestination()
 {
     destinationFlg          = false;
     actorDestination.Enable = false;
     destinationTrgActor     = null;
 }
Beispiel #38
0
        /// 壁の生成
        public void makeWall(int scrPosX, int scrPosY)
        {
            GameActorCollManager useCollMgr = actorDestination.GetMoveCollManager();

            Vector3 posStart = new Vector3(0, 0, 0);
            Vector3 posEnd   = new Vector3(0, 0, 0);

            /// チェックする開始座標と終了座標のセット
            ctrlResMgr.GraphDev.GetScreenToWorldPos(scrPosX, scrPosY, 0.0f, ref posStart);
            ctrlResMgr.GraphDev.GetScreenToWorldPos(scrPosX, scrPosY, 1.0f, ref posEnd);


            DemoGame.GeometryLine moveMoveLine = new DemoGame.GeometryLine(posStart, posEnd);

            /// 衝突対象の登録
            useCollMgr.TrgContainer.Clear();
            ctrlResMgr.CtrlTo.SetDestinationActor(useCollMgr.TrgContainer);
            useCollMgr.TrgContainer.Add(actorStg, actorStg.GetUseObj(0));


            /// 衝突判定
            calCollLook.SetMoveType(Data.CollTypeId.ChDestination);

            bool checkBound = calCollLook.Check(useCollMgr, moveMoveLine);

            if (checkBound)
            {
                /// マーカーのセット
//            actorDestination.Start();

                Matrix4 mtx = Matrix4.RotationY(0);
                destinationTrgActor = useCollMgr.TrgContainer.GetEntryObjParent(0);
                ShapeSphere bndSph = destinationTrgActor.GetBoundingShape();
                if (destinationTrgActor.CheckMoveTrgId() == 2)          //始点の建物に接触
                {
                    towerNowPos  = destinationTrgActor.BasePos;
                    TouchPostion = destinationTrgActor.BasePos;
                    if (towerPos.X != towerNowPos.X && towerPos.Z != towerNowPos.Z && !(towerPos.X == 0.0f && towerPos.Y == 0.0f && towerPos.Z == 0.0f))              //最初のタッチ以外もしくは前のタワー以外との接触の場合
                    {
                        if (bndSph != null)
                        {
                            towerNowPos.Y += bndSph.Sphre.R;
                        }
                        towerNowPos.Y         += 0.1f;
                        ctrlResMgr.AddWall     = true;
                        ctrlResMgr.AddWallPos1 = towerPos;
                        ctrlResMgr.AddWallPos2 = towerNowPos;
                        makeTowerFlag          = false;
                        Console.WriteLine("asdf");
                    }
                }
                else
                {
                    Console.WriteLine("fdsa");
                    towerNowPos    = calCollLook.NextPos;
                    TouchPostion   = calCollLook.NextPos;
                    towerNowPos.Y += 0.1f;
                    if (towerPos.X == 0.0f && towerPos.Y == 0.0f && towerPos.Z == 0.0f)
                    {
                        towerPos  = towerNowPos;
                        effectPos = towerNowPos;
                        //ctrlResMgr.CtrlTo.EntryAddTower( 1, 0.0f, towerNowPos, (int)StaticDataList.getRandom(0,5));
                    }
                    double dis2 = Common.VectorUtil.Distance(towerPos, towerNowPos);
                    if (dis2 > newTowerDis)
                    {
                        ctrlResMgr.AddWall     = true;
                        ctrlResMgr.AddWallPos1 = towerPos;
                        ctrlResMgr.AddWallPos2 = towerNowPos;

                        ctrlResMgr.AddTower    = true;
                        ctrlResMgr.AddTowerPos = towerNowPos;

                        TowerAreaNorth = FMath.Max(TowerAreaNorth, towerNowPos.X);
                        TowerAreaSouth = FMath.Min(TowerAreaSouth, towerNowPos.X);
                        TowerAreaEast  = FMath.Max(TowerAreaEast, towerNowPos.Z);
                        TowerAreaWest  = FMath.Min(TowerAreaWest, towerNowPos.Z);
                        //AppSound.GetInstance().PlaySeCamDis( AppSound.SeId.MakeMo, towerNowPos );

                        towerPos = towerNowPos;
                        //sumPos += towerPos;
                        //sumcount++;
                    }
                    dis2 = Common.VectorUtil.Distance(effectPos, towerNowPos);
                    if (dis2 > newEffectDis)
                    {
                        ctrlResMgr.AddEffectFromEnemy = true;
                        ctrlResMgr.AddEnemyEffectPos  = towerNowPos;
                        effectPos = towerNowPos;
                    }
                }
            }
        }
        /// キャラクタの登録
        public void EntryCharacter( GameActorProduct actor, bool cullingFlg )
        {
            ShapeSphere bndSph = actor.GetBoundingShape();

            if( cullingFlg == false || cullingShape.CheckNearDis( bndSph.Sphre.Pos ) < bndSph.Sphre.R ){
            float dis = Common.VectorUtil.Distance( actor.BasePos, GameCtrlManager.GetInstance().CtrlCam.GetCamPos() );
            entryActor( actor, dis );
            }
        }
Beispiel #40
0
        /// 壁の生成
        public void makeWall( int scrPosX, int scrPosY )
        {
            GameActorCollManager       useCollMgr    = actorDestination.GetMoveCollManager();

            Vector3 posStart = new Vector3(0,0,0);
            Vector3 posEnd = new Vector3(0,0,0);

            /// チェックする開始座標と終了座標のセット
            ctrlResMgr.GraphDev.GetScreenToWorldPos( scrPosX, scrPosY, 0.0f, ref posStart );
            ctrlResMgr.GraphDev.GetScreenToWorldPos( scrPosX, scrPosY, 1.0f, ref posEnd );

            DemoGame.GeometryLine moveMoveLine = new DemoGame.GeometryLine( posStart, posEnd );

            /// 衝突対象の登録
            useCollMgr.TrgContainer.Clear();
            ctrlResMgr.CtrlTo.SetDestinationActor( useCollMgr.TrgContainer );
            useCollMgr.TrgContainer.Add( actorStg, actorStg.GetUseObj(0) );

            /// 衝突判定
            calCollLook.SetMoveType( Data.CollTypeId.ChDestination );

            bool checkBound = calCollLook.Check( useCollMgr, moveMoveLine );
            if( checkBound ){
            /// マーカーのセット
            //            actorDestination.Start();

            Matrix4 mtx = Matrix4.RotationY( 0 );
            destinationTrgActor = useCollMgr.TrgContainer.GetEntryObjParent(0);
            ShapeSphere bndSph  = destinationTrgActor.GetBoundingShape();
            if( destinationTrgActor.CheckMoveTrgId() == 2){	//始点の建物に接触
                towerNowPos = destinationTrgActor.BasePos;
                TouchPostion = destinationTrgActor.BasePos;
                if(towerPos.X != towerNowPos.X && towerPos.Z != towerNowPos.Z && !(towerPos.X == 0.0f &&  towerPos.Y == 0.0f && towerPos.Z == 0.0f)){ //最初のタッチ以外もしくは前のタワー以外との接触の場合
                    if( bndSph != null ){
                        towerNowPos.Y += bndSph.Sphre.R;
                    }
                    towerNowPos.Y += 0.1f;
                    ctrlResMgr.AddWall = true;
                    ctrlResMgr.AddWallPos1 = towerPos;
                    ctrlResMgr.AddWallPos2 = towerNowPos;
                    makeTowerFlag = false;
                    Console.WriteLine("asdf");
                }
            }else{
                Console.WriteLine("fdsa");
                towerNowPos = calCollLook.NextPos;
                TouchPostion = calCollLook.NextPos;
                towerNowPos.Y += 0.1f;
                if(towerPos.X == 0.0f &&  towerPos.Y == 0.0f && towerPos.Z == 0.0f){
                    towerPos = towerNowPos;
                    effectPos = towerNowPos;
                    //ctrlResMgr.CtrlTo.EntryAddTower( 1, 0.0f, towerNowPos, (int)StaticDataList.getRandom(0,5));
                }
                double dis2 = Common.VectorUtil.Distance( towerPos , towerNowPos );
                if(dis2 > newTowerDis){
                    ctrlResMgr.AddWall = true;
                    ctrlResMgr.AddWallPos1 = towerPos;
                    ctrlResMgr.AddWallPos2 = towerNowPos;

                    ctrlResMgr.AddTower = true;
                    ctrlResMgr.AddTowerPos = towerNowPos;

                    TowerAreaNorth = FMath.Max(TowerAreaNorth , towerNowPos.X);
                    TowerAreaSouth = FMath.Min(TowerAreaSouth , towerNowPos.X);
                    TowerAreaEast = FMath.Max(TowerAreaEast , towerNowPos.Z);
                    TowerAreaWest = FMath.Min(TowerAreaWest , towerNowPos.Z);
                    //AppSound.GetInstance().PlaySeCamDis( AppSound.SeId.MakeMo, towerNowPos );

                    towerPos = towerNowPos;
                    //sumPos += towerPos;
                    //sumcount++;
                }
                dis2 = Common.VectorUtil.Distance( effectPos , towerNowPos );
                if(dis2 > newEffectDis){
                    ctrlResMgr.AddEffectFromEnemy = true;
                    ctrlResMgr.AddEnemyEffectPos = towerNowPos;
                    effectPos = towerNowPos;
                }
            }
            }
        }
 /// イベントの登録
 public bool Add(GameActorProduct actor)
 {
     actorList.Add(actor);
     return(true);
 }
Beispiel #42
0
        /// 食べる目標決め
        public void setEatTarget( int scrPosX, int scrPosY )
        {
            GameActorCollManager       useCollMgr    = actorDestination.GetMoveCollManager();

            Vector3 posStart = new Vector3(0,0,0);
            Vector3 posEnd = new Vector3(0,0,0);

            /// チェックする開始座標と終了座標のセット
            ctrlResMgr.GraphDev.GetScreenToWorldPos( scrPosX, scrPosY, 0.0f, ref posStart );
            ctrlResMgr.GraphDev.GetScreenToWorldPos( scrPosX, scrPosY, 1.0f, ref posEnd );

            DemoGame.GeometryLine moveMoveLine = new DemoGame.GeometryLine( posStart, posEnd );

            /// 衝突対象の登録
            useCollMgr.TrgContainer.Clear();

            ctrlResMgr.CtrlHobit.SetDestinationActor( useCollMgr.TrgContainer );
            ctrlResMgr.CtrlTo.SetDestinationActor( useCollMgr.TrgContainer );
            ctrlResMgr.CtrlWall.SetDestinationActor( useCollMgr.TrgContainer );
            ctrlResMgr.CtrlHouse.SetDestinationActor( useCollMgr.TrgContainer );

            //        ctrlResMgr.CtrlTo.SetDestinationActor( useCollMgr.TrgContainer );
            //        ctrlResMgr.CtrlWall.SetDestinationActor( useCollMgr.TrgContainer );

            /// 衝突判定
            calCollLook.SetMoveType( Data.CollTypeId.ChDestination );

            bool checkBound = calCollLook.Check( useCollMgr, moveMoveLine );

            if( checkBound ){
            /// マーカーのセット
            destinationTrgActor = useCollMgr.TrgContainer.GetEntryObjParent(0);
            ShapeSphere bndSph  = destinationTrgActor.GetBoundingShape();

            if( destinationTrgActor.CheckMoveTrgId() == 1 ){
                if( bndSph != null ){
                    TouchPostion = bndSph.Sphre.Pos;
                }
                else{
                    TouchPostion = destinationTrgActor.BasePos;
                }
                destinationTrgActor.SetEatFlag();
            }
            else if( destinationTrgActor.CheckMoveTrgId() == 2 ){
                if( bndSph != null ){
                    TouchPostion = bndSph.Sphre.Pos;
                }
                else{
                    TouchPostion = destinationTrgActor.BasePos;
                }
                destinationTrgActor.SetEatFlag();
            }
            else if( destinationTrgActor.CheckMoveTrgId() == 3 ){
                if( bndSph != null ){
                    TouchPostion = bndSph.Sphre.Pos;
                }
                else{
                    TouchPostion = destinationTrgActor.BasePos;
                }
                destinationTrgActor.SetEatFlag();
            }else if( destinationTrgActor.CheckMoveTrgId() == 4 ){
                if( bndSph != null ){
                    TouchPostion = bndSph.Sphre.Pos;
                }
                else{
                    TouchPostion = destinationTrgActor.BasePos;
                }
                destinationTrgActor.SetEatFlag();
            }else{
                TouchPostion = calCollLook.NextPos;
            }
            }
        }
 public void Clear()
 {
     Obj          = null;
     ObjParent    = null;
     CollFlg      = false;
 }
Beispiel #44
0
 public void ClearMakeWall()
 {
     towerPos.Xyz = StaticDataList.getVectorZero();
     effectPos.Xyz = StaticDataList.getVectorZero();
     if(mode == 1){
     //			ctrlResMgr.CtrlHobit.SetCtrlStateId(CtrlHobitemy.CtrlStateId.Eat);
     //			ctrlResMgr.CtrlCam.SetCamMode( CtrlCamera.ModeId.LookMyself );
     }
     mode = 0;
     TouchCount = 0;
     makeTowerFlag 			= true;
     destinationFlg          = false;
     actorDestination.Enable = false;
     destinationTrgActor     = null;
 }
        /// private
        ///---------------------------------------------------------------------------
        /// 攻撃範囲チェック
        private bool attackAreaCheck( GameActorProduct myActor, GameActorProduct trgActor, float rotR, float rotL, float disArea )
        {
            float dis = Common.VectorUtil.Distance( myActor.BasePos, trgActor.BasePos );

            if( dis <= disArea ){
            float rot = Common.MatrixUtil.GetPointRotY( myActor.BaseMtx, myActor.BasePos, trgActor.BasePos );

            if( rot >= rotR && rot <= rotL ){
                return true;
            }
            }
            return false;
        }