コード例 #1
0
    public int CreateBounceShot(Vector2 startPosition, float rotation, float speed, bulletColor color)
    {
        int ret = CreateShot(startPosition, rotation, speed, color);

        //Bullet shot = GetBullet(ret);
        //.SetTag("bound");
        return(ret);
    }
コード例 #2
0
    public int CreateShot(Vector2 startPosition, float rotation, float speed, bulletColor color)
    {
        if (MovePointer())
        {
            Bullet newShot = GetBullet(poolPointer);

            newShot.obj.SetActive(true);
            newShot.obj.transform.position = startPosition;
            SetVelocity(newShot.id, rotation, speed);
            SetColor(bullets[newShot.id], color);
            return(newShot.id);
        }
        return(-1);
    }
コード例 #3
0
 public void SetColor(Bullet shot, bulletColor color)
 {
     shot.anim.SetTrigger(color.ToString());
     shot.GetObj().tag = color.ToString();
 }
コード例 #4
0
 public void SetColor(Bullet shot, bulletColor color)
 {
     shot.anim.SetTrigger(color.ToString());
     //shot.anim.SetInteger("CherryColor", 3);
     //shot.anim.SetInteger("CherryColor", bulletColor.color);
 }
コード例 #5
0
    public int CreateShotAtFrame(Vector2 startPosition, Vector2 destination, int frame, bulletColor color)
    {
        if (MovePointer())
        {
            Bullet newShot = new Bullet();
            newShot.id = poolPointer;

            newShot.obj = bullets[newShot.id].obj;
            newShot.rb  = bullets[newShot.id].rb;
            newShot.obj.SetActive(true);
            newShot.obj.transform.position = startPosition;
            float rotation = GetAngle(startPosition, destination);
            float distance = GetDistance(startPosition, destination);
            SetVelocity(newShot.id, rotation, 10 * distance / frame);
            return(newShot.id);
        }
        return(-1);
    }