void UnlockMatches()
    {
        LightMatchScript lightMatch = Player.GetComponent <LightMatchScript>();

        lightMatch.enabled = true;
        EventManager.StopListening("UnlockMatches", UnlockMatches);
    }
 private void Awake()
 {
     LosePanelGroup.alpha = 0.0f;
     playerHpRef          = Player.GetComponent <Player_Health>();
     playerMove           = Player.GetComponent <Player_Movement>();
     matchRef             = Player.GetComponent <LightMatchScript>();
 }
Example #3
0
/*
    private void OnDrawGizmos()
    {
        if (Physics.Raycast(transform.position * 1.0f, transform.TransformDirection(Vector3.forward), out hit, 3))
        {
            Gizmos.color = Color.green;
            Gizmos.DrawLine(transform.position * 1.0f, transform.TransformDirection(Vector3.forward));
            //it works but wrong
        }
    }
*/
    private void Update()
    {
       
        //Testing preparation for sit animation
        if (Input.GetKeyDown(KeyCode.T))
        {
            //BeginToSit();
            sitting = true;
        }
        

       /* else if (this.InMyState)
        {
            this.InMyState = false;
            // You have just leaved your state!
        }*/
        if (Physics.Raycast(transform.position * 1.0f, transform.TransformDirection(Vector3.forward), out hit, 3))
        {
            if (hit.collider.tag == "Interactable")
            { 
                if (anim.GetBool("moving") == false)
                { 
                    if (Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown("joystick button 2"))//"X" Button
                    {
                        if (hit.collider == sitCollider)
                        {
                            LightMatchScript match = GameObject.Find("Player").GetComponent<LightMatchScript>();

                            if (match.isLit == true)
                            {
                                match.isLit = false;
                                StartCoroutine(DelayCheck());
                            }
                            GameObject GameManager = GameObject.Find("GameManager");
                            GameObject PuzzleChurch = GameManager.transform.Find("Puzzle Church").gameObject;
                            GameObject ChurchLight = PuzzleChurch.transform.Find("ChurchLight").gameObject;

                            if (ChurchLight.activeSelf)
                            {
                                transform.Rotate(0, rotation, 0);
                                anim.Play("Sit");
                            }
                        }
                            if (!this.anim.GetCurrentAnimatorStateInfo(0).IsName("Sit"))
                            {
                                TriggerEventScript tEvent = hit.collider.GetComponent<TriggerEventScript>();
                                tEvent.CallEvent();

                                anim.Play("Idle");
                            }
                    }
                }
            }
        }

        if (Input.GetKey("left shift") && SpntPan.GetComponent<CanvasGroup>().alpha == 1
            || Input.GetKey("joystick button 0") && SpntPan.GetComponent<CanvasGroup>().alpha == 1)//***Tianna!!*** "A" Button
        {
            //Sprint TUT
            SpntPan.GetComponent<CanvasGroup>().alpha = 0;//***Tianna!!***
        }
    }
Example #4
0
    void FixedUpdate()
    {
        
        forward = Camera.main.transform.forward;
        forward.y = 0;
        forward = Vector3.Normalize(forward);
        //right = Quaternion.Euler(new Vector3(0, 90, 0)) * forward;
        right = Camera.main.transform.right;
        right.y = 0;
        right = Vector3.Normalize(right);

        float h = Input.GetAxisRaw("Horizontal");
        float v = Input.GetAxisRaw("Vertical");
        matchSrpt = GetComponent<LightMatchScript>();

        //play anims w/ matchlit
        if (matchSrpt.isLit == true)
        {
            //anim.Play("MatchIdle");
            anim.SetBool("match", true);
        }
        else
        {
            anim.SetBool("match", false);
        }

        if (sitting)//Scripted Movement
        {
            MoveIntoPlace();
        }

        if (canMove)
        {
            Move(h, v);
            // anim.Play("Run");
            //       Vector3 movement = new Vector3(h, 0f, v);

   //borken         //Vector3 direction = new Vector3(Input.GetAxis("HorizontalKey"), 0, Input.GetAxis("VerticalKey"));
            // Vector3 rightMovement = right * Input.GetAxis("HorizontalKey");
            // Vector3 upMovement = forward * Input.GetAxis("VerticalKey");
            //Vector3 movement = Vector3.Normalize(rightMovement + upMovement);

            //working         
            //movement = Vector3.Normalize(right * h + forward * v);
            //movement = Vector3.ClampMagnitude(movement, 1.0f) * moveSpeed;

            movement = Vector3.ClampMagnitude(movement, 1.0f) * moveSpeed;
            anim.SetFloat("Speed", movement.magnitude);
            transform.Translate(movement * Time.fixedDeltaTime, Space.World);
            
            if (mouseTurning)
            {
                MouseTurning();
            }
            else
            {
                MoveTurn();
            }
        }

        if (movement != Vector3.zero)
        {
            Sprint();   
            print("moving"); 
            
        }

    
    }
Example #5
0
 // Start is called before the first frame update
 void Start()
 {
     matchScriptRef = GetComponentInParent <LightMatchScript>();
 }
 // Start is called before the first frame update
 void Start()
 {
     matchRef = GameObject.Find("Player").GetComponent <LightMatchScript>();
 }
Example #7
0
 private void Awake()
 {
     Player      = GameObject.FindGameObjectWithTag("Player");
     playerMatch = Player.GetComponent <LightMatchScript>();
     playerHP    = Player.GetComponent <Player_Health>();
 }