Esempio n. 1
0
 public void Catch(ThingToProtect _thingToProtect)
 {
     thingToProtect = _thingToProtect;
     closedClaw.SetActive(true);
     openClaw.SetActive(false);
     playerAnimationController.SetThrowMode(false);
 }
Esempio n. 2
0
    void Update()
    {
        if (Time.timeScale > 0)
        {
            Vector3 aimPosition /*= new Vector3( 0.0f, 1.0f, 0.0f )*/;

            if (belongsToPlayer)
            {
                Vector3 v3 = Input.mousePosition;
                v3.z        = cameraDistance;
                aimPosition = TheCamera.ScreenToWorldPoint(v3);
            }
            else
            {
                if (HasAnyObject())
                {
                    aimPosition = Player.mainPlayer.transform.position;
                }
                else
                {
                    SanjoEnemy enemyScript = owner.GetComponent <SanjoEnemy>();

                    ThingToProtect protectObj = enemyScript.GetAI().target;

                    aimPosition = protectObj.transform.position;
                }
            }

            Vector3 handPos         = GetHandPosition(aimPosition);
            float   angleFromPlayer = GetHandAngle(handPos);
            AdjustImageForAngle(angleFromPlayer);
            handMainTransform.rotation = Quaternion.Euler(0, 0, angleFromPlayer);
            handMainTransform.position = handPos;

            if (belongsToPlayer && Input.GetMouseButtonDown(0))
            {
                if (HasAnyObject())
                {
                    Throw();
                }
                //else
                //{
                //	FireGun();
                //}
            }

            imageT.localRotation = Quaternion.Lerp(imageT.localRotation, theIQ, Time.deltaTime * 3);
        }

        if (!belongsToPlayer && HasAnyObject())
        {
            Throw();
        }
    }
Esempio n. 3
0
 public void Throw()
 {
     if (HasThingToProtect() && thingToProtect.Visible)
     {
         thingToProtect.Throw(shootPoint.right);
         thingToProtect = null;
         closedClaw.SetActive(false);
         openClaw.SetActive(true);
         playerAnimationController.SetThrowMode(true);
     }
 }
Esempio n. 4
0
 private void OnTriggerStay2D(Collider2D collision)
 {
     if (!started)
     {
         ThingToProtect thingToProtect = collision.gameObject.GetComponent <ThingToProtect>();
         if (thingToProtect != null)
         {
             flowerSprite.enabled = true;
             thingToProtect.SetVisible(false);
             Destroy(thingToProtect.mainRigidbody);
             started = true;
             StartCoroutine(EndRoutine());
         }
     }
 }
Esempio n. 5
0
    private void OnTriggerStay2D(Collider2D collision)
    {
        ThingToProtect thingToProtect = collision.gameObject.GetComponent <ThingToProtect>();

        if (thingToProtect != null)
        {
            if (Time.frameCount - LevelClearManager.lastActivateFrame > 15)
            {
                LevelClearManager.lastActivateFrame = Time.frameCount;
                //if (Player.mainPlayer.handController.HasThingToProtect()) {
                AudioManager.Instance.PlayWinSound();
                LevelClearManager.LevelClear(Time.time - startTime);
                thingToProtect.transform.SetParent(flowerPosition, false);
                thingToProtect.transform.localPosition = new Vector3(0, 0, 0);
                thingToProtect.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 90));
                //}
            }
        }
    }