// //override means i am using this Start() not the parent(unit)'s start, but calling base.start() means i call it as well override public void Awake() { base.Awake(); baseWalkSpeed = walkSpeed; platformMask = LayerMask.GetMask("Ground"); Spawner = GameObject.FindGameObjectWithTag("GameController").GetComponent <CrabSpawner>(); player = GameObject.FindGameObjectWithTag("Player"); //this is the guy we hate yOffset = GetComponent <BoxCollider2D>().bounds.extents.y; if (player != null) { targetPlace = player.transform.position; } stunTime = 1f; //death stuff crabMeat = Resources.Load("Prefab/CrabMeat") as GameObject; blood = Resources.Load("Prefab/Blood") as GameObject; for (int x = 0; x < bodyParts.Length; x++) { bodyParts[x] = Resources.Load("Prefab/CrabPart" + (x + 1)) as GameObject; } // if (stacking) { stackOffset = buddy.GetComponent <BoxCollider2D> ().bounds.extents.y + this.GetComponent <BoxCollider2D>().bounds.extents.y; this.GetComponent <BoxCollider2D> ().enabled = false; rb2d.gravityScale = 0; } }
// Start is called before the first frame update void Start() { collectScore = PlayerPrefs.GetInt("pearls"); healthScore = PlayerPrefs.GetInt("health"); playerScore = Random.Range(0, 20); spawner = FindObjectOfType <CrabSpawner>(); healthText.text = "Health : " + healthScore + "hp"; playerText.text = "Crabs Remaining : " + playerScore; collectText.text = "Pearls Collected : " + collectScore; }
public override void Start() { base.Start(); //Do not erase this line! cs = this; }
void Start() { spawner = FindObjectOfType <CrabSpawner>(); health = FindObjectOfType <Health>(); }