Esempio n. 1
0
 static void EnableRoleCollider(GameObject go, bool isEnable)
 {
     if (go)
     {
         RoleColider col = go.GetComponent <RoleColider>();
         if (col)
         {
             col.EnableCollider(isEnable);
         }
     }
 }
Esempio n. 2
0
    /// <summary>
    /// 发送炮弹兵
    /// </summary>
    public static bool Fire(List <Vector3> lFlyPoint, int RoleID, SoldierInfo Soldier, bool IsPlayer)
    {
        if (Soldier == null || lFlyPoint == null || lFlyPoint.Count < 3)
        {
            return(false);
        }

        Role SoldierRole = null;
        int  sceneID     = CM.DataID2SceneIDInSoldier(RoleID);
        Life life        = CM.GetLifeM(sceneID, LifeMType.SOLDIER);

        if (life == null)
        {
            int RoleType = Soldier.m_modeltype;
            if (RoleType == 102003)
            {
                RoleType = 1020032;
            }
            if (RoleType == 200009)
            {
                RoleType = 2000092;
            }
            string    SoldierName = Soldier.m_name;
            Transform FlyNode     = BattleEnvironmentM.GetLifeMBornNode(false);
            FlyNode.position = new Vector3(FlyNode.position.x, FlyNode.position.y, -0.5f);
            //IGameRole i = GameRoleFactory.Create(FlyNode, RoleType, SoldierName, AnimatorState.Fly00000);
            SoldierRole = LifeFactory.CreateRole(FlyNode, AnimatorState.Fly00000, Soldier, LifeMCamp.ATTACK, RoleID, MoveState.Fly, Int2.zero, LifeEnvironment.Combat);
            GameObject  go  = SoldierRole.RoleSkinCom.tRoot.gameObject;
            RoleColider col = SoldierRole.RoleSkinCom.tBody.gameObject.GetComponent <RoleColider>();
            col.EnableColider(ColiderType.Fire, true);
            Vector3 dir = lFlyPoint[1] - lFlyPoint[0];
            if (dir.x <= 0)
            {
                SoldierRole.RoleSkinCom.SetMirror(1, 1, 1);
            }
            else
            {
                SoldierRole.RoleSkinCom.SetMirror(-1, 1, 1);
            }
        }
        else
        {
            life.SetActive(true);
            SoldierRole           = life as Role;
            SoldierRole.m_bReBorn = false;
        }

        if (SoldierRole != null)
        {
            if (IsPlayer)
            {
                GodSkillWnd gsw = WndManager.FindDialog <GodSkillWnd>();
                if (gsw != null)
                {
                    gsw.ChangeBiaoqing((int)CaptionExpress.fire);
                }
            }

            if (SoldierRole.MoveAI != null && SoldierRole.MoveAI is Fly)
            {
                (SoldierRole.MoveAI as Fly).SetTrailFly(lFlyPoint);
                PlayFlyMusic(Soldier.m_modeltype);
            }
        }

        return(true);
    }