Ejemplo n.º 1
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 2
0
    void Awake()
    {
        gameObject.layer = transform.parent.gameObject.layer;

        sprite                = transform.GetChild(0);
        trail                 = sprite.GetComponent <TrailRenderer>();
        initialSpriteSize     = sprite.localScale;
        initialSpritePosition = sprite.localPosition;
        controller            = GetComponent <HatController> ();
        col = GetComponent <BoxCollider2D> ();
    }
Ejemplo n.º 3
0
 //   public bool playerAtHat = false;
 // Use this for initialization
 void Awake()
 {
     if (StaticRef == null) // if theres is not allerdaye a static ref makes this the static ref
     {
     //    DontDestroyOnLoad(gameObject);
         StaticRef = this;
     }
     else if (StaticRef != this) // is the allready is a ref , destory this
     {
         Destroy(this);
     }
 }
Ejemplo n.º 4
0
    //   public bool playerAtHat = false;

    // Use this for initialization

    void Awake()
    {
        if (StaticRef == null) // if theres is not allerdaye a static ref makes this the static ref
        {
            //    DontDestroyOnLoad(gameObject);
            StaticRef = this;
        }
        else if (StaticRef != this) // is the allready is a ref , destory this
        {
            Destroy(this);
        }
    }
Ejemplo n.º 5
0
    void OnTriggerExit2D(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            Controller2D p = other.gameObject.GetComponent <Controller2D> ();
            if (p != null)
            {
                transform.parent.GetComponent <Liquid>().Splash(other.transform.position.x, 0.3f);
            }

            //print ("bye!");
        }

        if (other.CompareTag("Hat"))
        {
            HatController h = other.gameObject.GetComponent <HatController> ();
            if (h != null)
            {
                transform.parent.GetComponent <Liquid>().Splash(other.transform.position.x, 0.3f);
            }
        }
    }
Ejemplo n.º 6
0
 void Start()
 {
     hat           = GetComponent <Hat>();
     hatController = GetComponent <HatController>();
 }