// Use this for initialization
 void Start()
 {
     collisionComponent = GetComponent <CharacterCollision> ();
     rb = GetComponent <Rigidbody2D> ();
     enemyKillComponent       = GetComponent <EnemyKilling> ();
     chainConnectionComponent = GetComponent <ChainConnection> ();
 }
Beispiel #2
0
 /// <summary>
 /// The Awake function is setup to make sure the required public variables are filled.
 /// </summary>
 protected void Awake()
 {
     characterCollisionScript = gameObject.GetComponent <CharacterCollision>();
     characterAnimationScript = gameObject.GetComponent <CharacterAnimation>();
     characterMovementScript  = gameObject.GetComponent <CharacterMovement>();
     playerCollider           = gameObject.GetComponent <Collider2D> ();
     characterRigidbody       = gameObject.GetComponent <Rigidbody2D>();
     if (characterCollisionScript == null)
     {
         Debug.LogError("Forgotten component: The player object doesn't has the CharacterCollision script.");
     }
     if (playerCollider == null)
     {
         Debug.LogError("Forgotten component: The player object doesn't have a collider2D, you rascal!");
     }
     if (RaycastCenter == null)
     {
         Debug.LogError("Forgotten reference: No raycast origin point is assigned to the jumpdown script on the player object.");
     }
 }
Beispiel #3
0
    protected void OnTriggerEnter2D(Collider2D collision)
    {
        CharacterCollision c = collision.GetComponent <CharacterCollision> ();

        if (c == null)
        {
            return;
        }

        onHit.Invoke();

        if (behaviour != null)
        {
            behaviour.OnHit(c.Character);

            if (behaviour.DestroyOnPickup)
            {
                Destroy(gameObject);
            }
        }
    }
    private void Update()
    {
        currentSoundCooldown += Time.deltaTime;

        if (instance == null)
        {
            instance = this;
        }

        if (SceneManager.GetActiveScene().name != "Corridor")
        {
            PlayerData.invulnerabilityRemaining -= Time.deltaTime;
        }

        if (PlayerData.invulnerabilityRemaining > 0 && !shield.activeInHierarchy)
        {
            shield.SetActive(true);
        }
        if (PlayerData.invulnerabilityRemaining <= 0 && shield.activeInHierarchy)
        {
            shield.SetActive(false);
        }
    }
 private void OnCollisionEnter(Collision collision)
 {
     CharacterCollision?.Invoke(collision);
 }
 private void Awake()
 {
     instance = this;
 }
 void Start()
 {
     collision = GetComponent <CharacterCollision>();
     baseSpeed = movementSpeed;
 }