public void ReleaseControl(IHost host, Vector3 releasePoint, float horizontalVelocity, float launchForce = 0f) { CatControl cat = host as CatControl; if (cat != null) { cat.visionController.setCatObjectVisibility(false); } var hostControl = ((MonoBehaviour)host); hostControl.enabled = false; var go = hostControl.gameObject; var hostHealth = go.GetComponent <PlayerHealth>(); hostHealth.enabled = false; healthFollowPlayer.player = transform; cameraFollow.player = transform; transform.position = releasePoint; gameObject.SetActive(true); collider1 = this.GetComponent <Collider2D>(); collider2 = go.GetComponent <Collider2D>(); Physics2D.IgnoreCollision(collider1, collider2); Invoke("ReenableColliders", .25f); //upward force maxSpeed = 10; Invoke("ResetSpeed", .4f); rigidbody.velocity = new Vector2(horizontalVelocity, 0); rigidbody.AddForce(Vector2.up * launchForce); /* * if (launchDirection.HasValue) * { * var finalLaunchDirection = launchDirection.Value; * if (Mathf.Abs(Vector2.Dot(finalLaunchDirection, Vector2.right)) >= 0.9) * { * finalLaunchDirection += Vector2.up; * finalLaunchDirection.Normalize(); * } * * * rigidbody.AddForce(finalLaunchDirection * launchForce); * } */ var parasiteHealth = GetComponent <PlayerHealth>(); parasiteHealth.enabled = true; }
private void StartGame() { CatControl control = cat.GetComponent <CatControl>(); control.inGame = true; control.JumpUp(); readyPic.GetComponent <SpriteRenderer>().material.DOFade(0f, 0.2f); tipPic.GetComponent <SpriteRenderer>().material.DOFade(0f, 0.2f); scoreMgr.GetComponent <ScoreMgr>().SetScore(0); pipeSpawner.GetComponent <PipeSpawner>().StartSpawning(); }
void Start() { catcontrol = GameObject.Find("Cat").GetComponent <CatControl>(); birthing = true; canFresh = false; }