public bool hit(GameObject target) { SanityManager targSAN = target.GetComponent <SanityManager>(); clockCntrl clock = target.GetComponent <clockCntrl>(); float dist = Vector2.Distance(target.transform.position, this.gameObject.transform.position); if (clock != null && targSAN != null && dist <= 0.4 && hitTmr == 0) { TimePasserCanv.SetActive(true); timePasser.prepareAnimation(); manager.StopAll(); targSAN.ChangeSanity(-10); clock.adjustTime(120); hitTmr = 200; InvManager.closeCurrInv(); InvCanv.SetActive(false); //Script to fade to black and transfer rooms to cover time change //Trigger animation / fade to black, on timer //timer is inherent to the screen for now, as it's a temporary placeholder feature //Whilst the screen is covered, the BC should be dealt with so that they are not in the same room when the player awakes BCAnimationCanvas.SetActive(true); this.gameObject.transform.position = BCTPPoint.gameObject.transform.position; myRoom = BCTPPoint.myRoom; curPoint = myRoom.getEntrancePoint(); target.transform.position = playerTPPoint.transform.position; target.GetComponent <PlayerMovement>().changeRoom(playerTPPoint.myRoom); target.GetComponent <PlayerMovement>().playerFloor = "FirstFloor"; //Send Typewriter Message SendMessageInOrder(); return(true); } else { Debug.Log("Tried to hit, failed"); return(false); } }
// Start is called before the first frame update void Start() { Clockctrl = gameObject.GetComponent <clockCntrl>(); }