public void CollectObject() { System.Random gen = new System.Random(); COLLECTABLE_TYPE type = (COLLECTABLE_TYPE)gen.Next((int)COLLECTABLE_TYPE.NUM_COLL); switch (type) { case COLLECTABLE_TYPE.BLUE_PROJECTILE: projectile = blueProjectilePrefab; break; case COLLECTABLE_TYPE.RED_PROJECTILE: projectile = redProjectilePrefab; break; case COLLECTABLE_TYPE.GREEN_PROJECTILE: projectile = greenProjectilePrefab; break; case COLLECTABLE_TYPE.HEALING_OBJECT: projectile = redProjectilePrefab; SendMessage("Heal"); break; default: break; } }
// colleectale value should be 10, 20 or 30 public Collectable(int id, Vector2 pos, int value) { _id = id; _position = pos; _value = value; _collected = false; switch (value) { case 10: _type = COLLECTABLE_TYPE.STANDARD; break; case 20: _type = COLLECTABLE_TYPE.MEDIUM; break; case 30: _type = COLLECTABLE_TYPE.COMPLEX; break; } }