Exemplo n.º 1
0
 // When it's hit by a player
 public void PickedUp(Code_Player player)
 {
     if (!CheckPlayerForPickUp(player))
     {
         ActivatePickUpEffect(player);
     }
     PoolPickUp();
 }
Exemplo n.º 2
0
    // When the shield touches a player it "knocks back the player"
    public void OnTriggerEnter(Collider col)
    {
        Transform colTrans = col.transform;

        if (col.gameObject != parentPlayer)
        {
            if (colTrans.CompareTag(playerTag) || colTrans.CompareTag(shieldTag))
            {
                Code_Player cP = colTrans.GetComponent <Code_Player>();
                if (cP != null)
                {
                    cP.StartKnockback(transform.position);
                    cP.KnockbackSound();
                    cP.DamageStamina(playerCode.ActualDamage);
                }
            }
        }
    }
Exemplo n.º 3
0
 // Stops the gameplay and announces the winner through the VictoryBanner GameObject
 private void AnnounceWinner(Code_Player winner)
 {
     victoryMessageText.text = victoryMessage + GetVictorsColor(winner.playerNumber);
     victoryBanner.SetActive(true);
 }
Exemplo n.º 4
0
 // Overidable function for it's children
 public virtual void ActivatePickUpEffect(Code_Player player)
 {
     print("Activated by player"); // For when a dev made a child but did not override this function
 }
Exemplo n.º 5
0
 // Checks if the player already possess the same pickup
 public virtual bool CheckPlayerForPickUp(Code_Player player)
 {
     print("Tell what to do when the player has the same pickup activated already"); // For when a dev made a child but did not override this function
     // Return a bool based on the results of the check above
     return(false);                                                                  // False means that the player does not possess the same pickup effect
 }
Exemplo n.º 6
0
    // Checks if the player already possesses has a Teleport
    public override bool CheckPlayerForPickUp(Code_Player player)
    {
        bool canRTP = !player.didTP;

        return(canRTP); // didTP must be false for true for this function to work, so it'll have to be inversed
    }
Exemplo n.º 7
0
 // Gives the player a new Teleport
 public override void ActivatePickUpEffect(Code_Player player)
 {
     player.ResetTelePort();
 }
Exemplo n.º 8
0
    private string shieldTag = "Shield"; // A tag we are looking for when hitting an object, just meant for microoptimisation

    // Use this for initialization
    void Start()
    {
        anim       = GetComponent <Animator>();
        myCol      = GetComponent <BoxCollider>();
        playerCode = parentPlayer.GetComponent <Code_Player>();
    }
Exemplo n.º 9
0
 // Overidable function for it's children
 public override void ActivatePickUpEffect(Code_Player player)
 {
     player.IncreaseStamina(staminaAmount); // For when a dev made a child but did not override this function
 }
Exemplo n.º 10
0
    public float staminaAmount; // Amount with which the stamina will be increased by once picked up

    // Checks if the player already possess the same pickup
    public override bool CheckPlayerForPickUp(Code_Player player)
    {
        return(false); // must always be false because the player itself checks the effect
    }
Exemplo n.º 11
0
 // Checks if the player already possess the same pickup
 public override bool CheckPlayerForPickUp(Code_Player player)
 {
     return(player.GetDeathShield());
 }
Exemplo n.º 12
0
 // Gives the player a DeathShield
 public override void ActivatePickUpEffect(Code_Player player)
 {
     player.SetDeathShield();
 }
Exemplo n.º 13
0
 // Use this for initialization
 void Start()
 {
     playerParent = transform.parent.GetComponent <Code_Player>();
 }
Exemplo n.º 14
0
    public float multiplierIncremental; // With how much it has to increase the value of damageMultiplier

    // Checks if the player already possess the same pickup
    public override bool CheckPlayerForPickUp(Code_Player player)
    {
        return(false); // This must always be false since it does not have to check for anything, the player itself will do this later on
    }
Exemplo n.º 15
0
 // Overidable function for it's children
 public override void ActivatePickUpEffect(Code_Player player)
 {
     player.IncreaseDamageMultiplier(multiplierIncremental);
 }