void Start() { Camera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraMech>(); CanTurn = true; PlayerTransform = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); EnemyRBD = GetComponent <Rigidbody2D>(); if (Speed > 0) { if (CanTurn) { InvokeRepeating("Walk", 1, Cooldown); } } }
// Use this for initialization void Start() { play_foot = false; prev_foot = play_foot; sounds.PlaySound("wind"); spawn_pos = transform.position + new Vector3(0, 10, 0); spawn_angle = transform.eulerAngles; last_angle = transform; UI = UI_obj.GetComponent <UI>(); UI_components = UI_obj.GetComponentsInChildren <RectTransform>(true); other_player = other_player_obj.GetComponent <PlayerOnTick>(); swimming = false; swim_first_time = false; playing = false; at_canon = false; show_canon = false; exited = true; entered = false; jumpable = true; boosting = false; trash_count = 0; boost_timer = 40; land_speed = walk_default; water_speed = swim_default; cam_cam = GetComponentInChildren <Camera>(); default_fov = cam_cam.fieldOfView; anim = GetComponentInChildren <ControlAnim>(); cam = GetComponentInChildren <CameraMech>(); cam_trans = cam.gameObject.transform; body_rb = GetComponent <Rigidbody>(); feet = GetComponentInChildren <Grounded>(); start_pos = transform; canon = canon_obj.GetComponent <CanonMech>(); canon_trans = canon_obj.GetComponentsInChildren <Transform>(true); canon_cam = canon_trans[6].gameObject; canon_cam_cam = canon_cam.GetComponent <Camera>(); spawn_cam_angle = cam_cam.gameObject.transform.eulerAngles; water_level = Water_Layer.transform.position.y; }