示例#1
0
    public void Setup(PelletType pelletType, Vector2 position, Vector2 direction)
    {
        this.pelletType = pelletType;
        switch (pelletType)
        {
        case PelletType.blue:
            speed = 10;
            break;

        case PelletType.red:
            speed = 10;
            break;

        case PelletType.yellow:
            speed = 10;
            break;
        }

        this.direction     = direction;
        transform.position = position;
        currentVector      = position;
        targetVector       = position;
        gameObject.SetActive(true);
        Invoke("DisableSelf", 5);
    }
 public override void OnHit(PelletType pelletType)
 {
     Debug.Log("hit");
     if (pelletType == weakness)
     {
         if (UpdateHealth(-LOW_DAMAGE))
         {
             OnObjectDestroyed();
         }
     }
 }
 public static bool RemovePellets(PelletType pelletType, int amount)
 {
     if (Instance.pellets[pelletType] >= amount)
     {
         HUDControl.UpdatePelletDisplay(pelletType, Instance.pellets [pelletType] -= amount);
         return(true);
     }
     else
     {
         return(false);
     }
 }
    public static void UpdateWeaponDisplay(PelletType pelletType)
    {
        switch (pelletType)
        {
        case PelletType.yellow:
            instance.weapon01Display.SetActive(true);
            break;

        case PelletType.red:
            instance.weapon02Display.SetActive(true);
            break;

        case PelletType.blue:
            instance.weapon03Display.SetActive(true);
            break;
        }
    }
    public static void UpdatePelletDisplay(PelletType pelletType, int amount)
    {
        switch (pelletType)
        {
        case PelletType.yellow:
            instance.yellowPelletDisplay.text = amount.ToString().PadLeft(3, '0');
            break;

        case PelletType.red:
            instance.redPelletDisplay.text = amount.ToString().PadLeft(3, '0');
            break;

        case PelletType.blue:
            instance.bluePelletDisplay.text = amount.ToString().PadLeft(3, '0');
            break;
        }
    }
 public virtual void OnHit(PelletType pelletType)
 {
     if (pelletType == weakness)
     {
         if (UpdateHealth(-HIGH_DAMAGE))
         {
             OnObjectDestroyed();
         }
     }
     else if (pelletType == weakness.Next())
     {
         Debug.Log("medium damage");
         if (UpdateHealth(-MEDIUM_DAMAGE))
         {
             OnObjectDestroyed();
         }
     }
 }
示例#7
0
    public void SetPelletType(PelletType pelletType)
    {
        this.pelletType = pelletType;
        SpriteRenderer rend = GetComponent <SpriteRenderer> ();

        switch (pelletType)
        {
        case PelletType.yellow:
            rend.color = Color.yellow;
            break;

        case PelletType.red:
            rend.color = Color.red;
            break;

        case PelletType.blue:
            rend.color = Color.blue;
            break;
        }
    }
示例#8
0
        public Pellet(Enemy origin, ConsoleKey direction, PelletType type = PelletType.Standard)
        {
            _type  = type;
            _x     = origin.X;
            _y     = origin.Y;
            _clock = 1;

            switch (direction)
            {
            case ConsoleKey.UpArrow:
                _velocity = new int[] { 0, -1 };
                break;

            case ConsoleKey.RightArrow:
                _velocity = new int[] { 1, 0 };
                break;

            case ConsoleKey.DownArrow:
                _velocity = new int[] { 0, 1 };
                break;

            case ConsoleKey.LeftArrow:
                _velocity = new int[] { -1, 0 };
                break;

            default:
                _velocity = new int[] { 0, 0 };
                Console.WriteLine("Invalid Pellet Direction");
                break;
            }

            if (_type == PelletType.Standard)
            {
                _symbol = 'o';
            }
            else if (_type == PelletType.StaticShooter)
            {
                _symbol = '҉';
            }
            Move();
        }
 public static void AddPellet(PelletType pelletType)
 {
     HUDControl.UpdatePelletDisplay(pelletType, Instance.pellets [pelletType] += 1);
 }
示例#10
0
 public Pellet(PelletType type, int score)
 {
     _type    = type;
     _score   = score;
     _isEaten = false;
 }
示例#11
0
 public static void CreatePellet(Enemy origin, ConsoleKey direction, PelletType type = PelletType.Standard)
 {
     pellets.Add(new Pellet(origin, direction, type));
 }
示例#12
0
 public PelletEventArgs(PelletType PType, Point PelletLocation)
 {
     _pelletType = PType;
     _pelletLocation = PelletLocation;
 }