コード例 #1
0
 public void GoldCoinEffect(int num, int count)
 {
     for (int i = 0; i < num; i++)
     {
         Vector3 pos = MapGrid.GetMG(m_Attr.Pos).pos;            //+new Vector3(Random.Range(1,m_Attr.Size*0.5f-2),-0.5f,1f);
         pos += new Vector3(0, 0.25f, 1.2f);
         pos  = BattleEnvironmentM.Local2WorldPos(pos);
         int n = (int)count / num;
         if (i == 0)
         {
             n += count - num * ((int)count / num);
         }
         GameObjectActionExcute gae = EffectM.LoadEffect("effect/prefab/", "2000041", EffectCamera.GetEffectPos(pos), BattleEnvironmentM.GetLifeMBornNode(true));
         //EffectCamera.AddFollowList(gae.transform,pos);
         if (gae != null)
         {
             GameObjectActionResourceDrop gaw = new GameObjectActionResourceDrop(2f, pos, pos + new Vector3(Random.Range(-1.5f, 1.5f), 0, 0));
             gae.AddAction(gaw);
             GameObjectActionResourceFlyToUI gar = new GameObjectActionResourceFlyToUI();
             gar.SetData(EffectCamera.camera, WndManager.GetNGUICamera(), n, ResourceType.Gold);
             gae.AddAction(gar);
             GameObject coin = U3DUtil.FindChild(gae.gameObject, "coin");
             if (coin != null)
             {
                 coin.GetComponent <ParticleSystem>().startDelay = Random.Range(1f, 1.5f);
             }
         }
     }
 }
コード例 #2
0
ファイル: DropResource.cs プロジェクト: 741645596/batgame
    static void DropResourceEffect(string name, ResourceType t, int num, int count, Vector3 pos)
    {
        pos    = BattleEnvironmentM.Local2WorldPos(pos);
        pos.x -= num / 2f;
        for (int i = 0; i < num; i++)
        {
            int n = (int)count / num;
            if (i == 0)
            {
                n += count - num * ((int)count / num);
            }
            pos.x += 1;            //Random.Range(0,2) == 0 ? - Random.Range(0,0.5f*num):Random.Range(0,0.5f*num);
            pos.z  = 0;
            GameObjectActionExcute gae = EffectM.LoadEffect("effect/prefab/", name, EffectCamera.GetEffectPos(pos), BattleEnvironmentM.GetLifeMBornNode(true));
            //EffectCamera.AddFollowList(gae.transform,pos);
            if (gae != null)
            {
                Random.seed++;
                GameObjectActionResourceDrop gaw = new GameObjectActionResourceDrop(2f, pos, pos + new Vector3(Random.Range(-1.5f, 1.5f), 0, 0));
                gae.AddAction(gaw);
                GameObjectActionResourceFlyToUI gar = new GameObjectActionResourceFlyToUI();
                gar.SetData(EffectCamera.camera, WndManager.GetNGUICamera(), n, t);
                gae.AddAction(gar);

                Animator ani = gae.gameObject.GetComponent <Animator>();
                if (null != ani)
                {
                    int nValue = (int)Random.value % 2;
                    if (nValue == 0)
                    {
                        nValue = 2;
                    }
                    ani.SetInteger("iState", nValue);
                }
            }
        }
    }