IEnumerator StartMoveNpcByItween(AnimatorNameNPC aniVal, float rootTime)
    {
        yield return(new WaitForSeconds(rootTime));

        if (IsDeathNPC || IsMoveToFirePoint)
        {
            yield break;
        }

        AnimatorNameNPC runAni = AnimatorNameNPC.Run1;

        if (aniVal == AnimatorNameNPC.Run1 ||
            aniVal == AnimatorNameNPC.Run2 ||
            aniVal == AnimatorNameNPC.Run3 ||
            aniVal == AnimatorNameNPC.Run4)
        {
            runAni = aniVal;
        }
        else
        {
            runAni = GetRandRunAniName();
        }
        PlayNpcAnimation(runAni);
        MoveNpcByItween();
        yield break;
    }
Exemple #2
0
 void CheckAniName()
 {
     if (AniName == AnimatorNameNPC.Fire1 || AniName == AnimatorNameNPC.Fire2 || AniName == AnimatorNameNPC.Fire3 ||
         AniName == AnimatorNameNPC.Fire4 || AniName == AnimatorNameNPC.Fire5 || AniName == AnimatorNameNPC.Fire6)
     {
         AniName = AnimatorNameNPC.Null;
     }
 }
Exemple #3
0
    void OnDrawGizmosSelected()
    {
        if (!IsDrawGizmos)
        {
            return;
        }

        if (!XkGameCtrl.IsDrawGizmosObj)
        {
            return;
        }

        if (!enabled)
        {
            return;
        }
        CheckTestTriggerSpawnNpc();
        CheckTestTriggerRemoveNpc();

        /*if (NpcObj != null) {
         *      XKNpcMoveCtrl npcScript = NpcObj.GetComponent<XKNpcMoveCtrl>();
         *      if (npcScript != null && npcScript.NpcState == NpcType.FlyNpc && npcScript.NpcJiFen != NpcJiFenEnum.FeiJi) {
         *              npcScript.NpcJiFen = NpcJiFenEnum.FeiJi;
         *      }
         * }*/

        if ((int)AniFangZhenFireRun < (int)AnimatorNameNPC.Run1 ||
            (int)AniFangZhenFireRun > (int)AnimatorNameNPC.Run2)
        {
            AniFangZhenFireRun = AnimatorNameNPC.Run1;
        }

        if ((int)AniRootName != (int)AnimatorNameNPC.Root1)
        {
            AniRootName = AnimatorNameNPC.Root1;
        }

        if (FireDistance > 0f)
        {
            Gizmos.color = new Color(0.5f, 0.9f, 1.0f, 0.3f);
            Gizmos.DrawSphere(transform.position, FireDistance);

            Gizmos.color = Color.green;
            Gizmos.DrawWireSphere(transform.position, FireDistance);
        }

        if (NpcPath != null && NpcPath.childCount > 0)
        {
            Transform[] tranArray = new Transform[2];
            tranArray[0] = transform;
            tranArray[1] = NpcPath.GetChild(0);
            iTween.DrawPath(tranArray, Color.blue);
        }
        MakeObjMoveToLand();
    }
Exemple #4
0
    void CheckAniName()
    {
        if (AniName == AnimatorNameNPC.Fire1 || AniName == AnimatorNameNPC.Fire2)
        {
            AniName = AnimatorNameNPC.Null;
        }
//		if (AniName == AnimatorNameNPC.Fire1 || AniName == AnimatorNameNPC.Fire2 || AniName == AnimatorNameNPC.Fire3
//		    || AniName == AnimatorNameNPC.Fire4 || AniName == AnimatorNameNPC.Fire5 || AniName == AnimatorNameNPC.Fire6) {
//			AniName = AnimatorNameNPC.Null;
//		}
    }
Exemple #5
0
    void ResetFangZhenObjInfo()
    {
        IsMoveEndPoint    = false;
        IsMoveToFirePoint = false;

        NpcTran             = null;
        MarkCount           = 0;
        FireDistance        = 0f;
        FangZhenNpcCount    = 0;
        CurrentRunAnimation = AnimatorNameNPC.Null;
        NpcMoveScript       = null;
    }
Exemple #6
0
    void PlayNpcAnimation(AnimatorNameNPC aniVal)
    {
        if (aniVal != AnimatorNameNPC.Null)
        {
            if (aniVal == AnimatorNameNPC.Run1 || aniVal == AnimatorNameNPC.Run2 ||
                aniVal == AnimatorNameNPC.Run3)
            {
                CurrentRunAnimation = aniVal;
            }

            for (int i = 0; i < NpcMoveScript.Length; i++)
            {
                if (NpcMoveScript[i] != null)
                {
                    NpcMoveScript[i].PlayNpcAnimation(aniVal);
                }
            }
        }
    }
Exemple #7
0
    public static AnimatorNameNPC GetRandRunAniName()
    {
        AnimatorNameNPC runAni  = AnimatorNameNPC.Run1;
        int             randVal = Random.Range(0, 50) % 3;

        if (randVal == 0)
        {
            runAni = AnimatorNameNPC.Run1;
        }
        else if (randVal == 1)
        {
            runAni = AnimatorNameNPC.Run2;
        }
        else
        {
            runAni = AnimatorNameNPC.Run3;
        }
        return(runAni);
    }
    /*********************************************************************
     * (AimStateVal == 0 || AimStateVal == 2) ---> AimPlayerFeiJi,
     * otherwise AimPlayerTanKe.
     ********************************************************************/
//	int AimStateVal = -1;
//	void SetAimState()
//	{
//		int aimState = 0;
//		if (SpawnPointScript.PointType == SpawnPointType.KongZhong) {
//			aimState = 0;
//		}
//		else if (SpawnPointScript.PointType == SpawnPointType.DiMian) {
//			aimState = 1;
//		}
//		else {
//			if (SpawnPointScript.IsAimFeiJiPlayer) {
//				aimState = 2;
//			}
//		}
//		AimStateVal = aimState;
//	}

    public static AnimatorNameNPC GetRandRunAniName()
    {
        AnimatorNameNPC runAni  = AnimatorNameNPC.Run1;
        int             randVal = Random.Range(0, 100) % 3;

        switch (randVal)
        {
        case 0:
            runAni = AnimatorNameNPC.Run1;
            break;

        case 1:
            runAni = AnimatorNameNPC.Run2;
            break;

        case 2:
            runAni = AnimatorNameNPC.Run4;
            break;
        }
        return(runAni);
    }
Exemple #9
0
    void MoveFangZhenNpcToFirePoint()
    {
        if (IsMoveToFirePoint)
        {
            return;
        }
        IsMoveToFirePoint = true;
        bool isBreak = false;
        int  count   = 0;
        int  index   = 0;

        iTween itweenScript = GetComponent <iTween>();

        if (itweenScript != null)
        {
            itweenScript.isRunning = false;
            itweenScript.isPaused  = true;
            itweenScript.enabled   = false;
        }

        do
        {
            if (IsDeathNPC)
            {
                isBreak = true;
                break;
            }

            if (NpcMoveScript[index] != null)
            {
                if (SpawnPointScript.AniFangZhenFireRun != AnimatorNameNPC.Null)
                {
                    PlayNpcAnimation(SpawnPointScript.AniFangZhenFireRun);
                }
                else if (CurrentRunAnimation == AnimatorNameNPC.Null)
                {
                    AnimatorNameNPC runAni = GetRandRunAniName();
                    PlayNpcAnimation(runAni);
                }

                float speed = SpawnPointScript.SpeedFangZhenFireRun;
                if (NpcPathScript != null && NpcMoveScript[index] != null)
                {
                    if (SpawnPointScript.FirePointGroup.Length < 1)
                    {
                        NpcMoveScript[index].MoveFZNpcToFirePoint(NpcFirePointGroup.GetChild(count).position, speed);
                    }
                    else
                    {
                        if (!NpcPathScript.IsMoveEndFire)
                        {
                            NpcMoveScript[index].MoveFZNpcToFirePoint(NpcFirePointGroup.GetChild(count).position, speed);
                        }
                        else
                        {
                            //移动到开火点组.
                            NpcMoveScript[index].MakeNpcMoveFirePoint();
                        }
                    }
                }
            }

            index++;
            if (index >= NpcMoveScript.Length)
            {
                isBreak = true;
                break;
            }

            count++;
            if (count >= NpcFirePointGroup.childCount)
            {
                count = 0;
            }
        } while(!isBreak);
        //Debug.Log("MoveFangZhenNpcToFirePoint...");
    }