Inheritance: MonoBehaviour
Example #1
0
 // Use this for initialization
 void Start()
 {
     direction   = new Vector3(Random.Range(-1f, 1f), Random.Range(-1f, 1f), 0f);
     sn          = this.GetComponent <PerlinShake>();
     gameManager = GameObject.FindGameObjectWithTag("GameManager");
     gm          = gameManager.GetComponent <GameManager> ();
 }
Example #2
0
 void Start()
 {
     animator  = GetComponent <Animator>();
     rigidbody = GetComponent <Rigidbody2D>();
     sprite    = GetComponent <SpriteRenderer>();
     GetComponent <PhantomTrail>().enabled = false;
     shake = GameObject.FindGameObjectWithTag("CameraShaker").GetComponent <PerlinShake> ();
 }
Example #3
0
 void InitInstance()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Example #4
0
    // Use this for initialization
    void Start()
    {
        Reset();

        rb.velocity = new Vector2(0, 0);
        GetComponent <Renderer>().enabled = false;
        dead = true;

        shake  = GetComponent <PerlinShake>();
        source = GetComponent <AudioSource>();
    }
Example #5
0
 void Awake()
 {
     if (_instance == null)
     {
         //If I am the first instance, make me the Singleton
         _instance = this;
     }
     else
     {
         //If a Singleton already exists and you find
         //another reference in scene, destroy it!
         if (this != _instance)
         {
             Destroy(this.gameObject);
         }
     }
 }
    void OnTriggerEnter2D(Collider2D other)
    {
        //Debug.Log("Game information: " + gameObject.name + " on enter triggered " + other.gameObject.name);
        switch (other.gameObject.tag)
        {
        case "Feather":
            featherCount++;
            Destroy(other.gameObject.transform.parent.gameObject);
            break;

        case "Bullet":
            break;

        case "End":
            //Application.LoadLevel(0);
            StartCoroutine(NextLevel());
            break;

        default:
            PerlinShake shaker = Camera.main.GetComponent <PerlinShake>();
            shaker.PlayShake();
            break;
        }
    }
	void Awake(){
		instance = this;
		currentState = State.normal;
		
		localPosition = this.transform.localPosition;
	}
Example #8
0
 // Use this for initialization
 void Start()
 {
     perlinshake = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <PerlinShake>();
     UIFunction  = GameObject.FindGameObjectWithTag("UIManager").GetComponent <UIFunctions>();
 }
Example #9
0
	void Awake(){
		instance = this;
		currentState = State.normal;
	}