// Use this for initialization void Start() { sound = GetComponent<AudioSource>(); cam = Camera.main.GetComponent<BaseballCameraController>(); rb = GetComponent<Rigidbody>(); anim = GetComponent <Animator>(); equipment = transform.FindChild("BatHand").gameObject; equipmentCollider = equipment.GetComponent<CapsuleCollider>(); //rend.material.color = c; speedMagnitude = 5f; jumpMagnitude = 23.6f; alive = true; anim.SetBool("Alive", true); ResetRigidBodyConstraints(); doubleJumpAllowed = true; impactMod = 7.5f; GetComponent<Renderer>().material.color = color; paint = GetComponent<PaintSplatterProjector>(); paint.Initialize (color); stats.ResetStats (); }
void Start() { // Get Components and Game Objects respawnPoints = GameObject.FindGameObjectsWithTag("RespawnPoint"); if (respawnPoints.Length == 0) { Debug.Log("There aren't any respawn points, you catastrophic dingus."); } sound = GetComponent<AudioSource>(); cam = Camera.main.GetComponent<OverheadCameraController>(); rb = GetComponent<Rigidbody>(); anim = GetComponent <Animator>(); equipmentCollider = GetComponentsInChildren<CapsuleCollider> ()[1]; // 0 returns collider on THIS object equipmentCollider.enabled = false; paint = GetComponent<PaintSplatterProjector> (); proj = GetComponentInChildren<Projector>(); Debug.Log("My projector is " + proj); paint.Initialize (color); // Set up color variables GetComponent<Renderer>().material.color = color; SetColorToParent[] kids = GetComponentsInChildren<SetColorToParent>(); Debug.Log("Kids length: " + kids.Length); foreach (SetColorToParent s in kids) { s.ResetColor(color); } colorChangeToUniform = false; colorLerpT = 0; // Set up general player variables alive = true; anim.SetBool("Alive", true); ResetRigidBodyConstraints(); walkSpeed = 10f; // Set up Golf specific variables swinging = false; putting = false; canRotateLeft = true; canRotateRight = true; stats.ResetStats (); }
void Start() { // Get Components and Game Objects rb = GetComponent<Rigidbody>(); anim = GetComponent<Animator> (); respawnPoints = GameObject.FindGameObjectsWithTag("RespawnPoint"); equipmentCollider = equipmentHand.GetComponentInChildren<CapsuleCollider> (); // 0 returns collider on THIS object equipmentCollider.enabled = false; if (respawnPoints.Length == 0) { Debug.Log("There aren't any respawn points, you catastrophic dingus."); } SetColorToParent[] renderers = GetComponentsInChildren<SetColorToParent>(); foreach (SetColorToParent rend in renderers) { rend.ResetColor(color); } GetComponent<Renderer>().material.color = color; // Set up general player variables alive = true; anim.SetBool("Alive", true); ResetRigidBodyConstraints(); walkSpeed = 3.5f; maxSpeed = 9; stats.ResetStats (); Debug.Log(stats); paint = GetComponent<PaintSplatterProjector>(); paint.Initialize (color); friction = 0.95f; }