Advertisement
CakeMeister

Spikes phan 13

Jul 7th, 2017
507
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.54 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Spikes : MonoBehaviour {
  6.     public Player player;
  7.     public int damage = 2 ;
  8.  
  9.  
  10.     // Use this for initialization
  11.     void Start () {
  12.         player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
  13.     }
  14.  
  15.     private void OnTriggerEnter2D(Collider2D col)
  16.     {
  17.         if (col.CompareTag("Player"))
  18.         {
  19.             player.Damage(damage);
  20.             player.Knockback(400f, player.transform.position);
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement