Ejemplo n.º 1
0
    /// <summary>
    /// 增加一个火球到场景
    /// </summary>
    public void addBall(SFBallConf conf)
    {
        var ballGO        = GameObject.Instantiate(ballPrefab);
        var ballComponent = ballGO.GetComponent <SFBallController>();

        ballComponent.init(conf);
        m_balls.Add(conf.ballId, ballComponent);
    }
Ejemplo n.º 2
0
 public void init(SFBallConf conf)
 {
     m_curPosX          = conf.posX;
     m_curPosY          = conf.posY;
     m_curSpeedX        = 0;
     m_curSpeedY        = 0;
     transform.position = new Vector3(conf.posX, 0, conf.posY);
     m_ballId           = conf.ballId;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 释放技能
 /// </summary>
 /// <param name="skillId">技能ID</param>
 /// <param name="skillData">技能描述信息,详见代码</param>
 public void skill(int skillId, string skillData)
 {
     if (skillId == (int)ESkill.FireBall)
     {
         // 释放火球
         // skillData表示火球ID,形如"ball_FGihX"的随机字符串
         if (SFBallManager.current != null)
         {
             SFBallConf conf = new SFBallConf();
             conf.ballId = skillData;
             conf.posX   = transform.position.x;
             conf.posY   = transform.position.z;
             SFBallManager.current.addBall(conf);
         }
     }
 }