コード例 #1
0
 protected virtual void OnDisable()
 {
     if (spawnee != null)
     {
         spawnee.Tick -= new Spawnee.TickHandler(RespawnAfter);
         Destroy(spawnee.gameObject);
     }
     ApplyOnce.remove("respawn", gameObject);
 }
コード例 #2
0
 public void Update()
 {
     if (ApplyOnce.alreadyApplied("Interact", gameObject))
     {
         if (player.FinishedAnimation("sitting_neutral") || player.FinishedAnimation("seated"))
         {
             manager.SetWarp(displayImg);
             ApplyOnce.remove("Interact", gameObject);
         }
     }
 }
コード例 #3
0
    void Update()
    {
        verifyLoad();

        if (startTime < transitionTime)
        {
            if (ApplyOnce.alreadyApplied("Reload", gameObject))
            {
                UpdateCircleConstricting();
                UpdateHalo();
                startTime--;
                if (startTime < 0)
                {
                    startTime = 0;
                    ApplyOnce.remove("Reload", gameObject);
                }
                ApplyOnce.apply("ChangeMode", gameObject, () => {
                    UIManager.GetInstance().ChangeMode(UIManager.Mode.NORMAL);
                    return(true);
                });
            }
            else
            {
                if (startTime == 0)
                {
                    UpdateLoadPoints();
                }
                UpdateCircleSimplified();
                startTime++;
                UpdateHalo();
            }

            if (startTime >= transitionTime)
            {
                ApplyOnce.apply("notifyAsderek", gameObject, () =>
                {
                    playerScript.ReceiveNotification(Asderek.Notification.Return);
                    warpImage      = null;
                    Time.timeScale = manager.chosenTime;
                    gameLoaded     = true;
                    ApplyOnce.remove("ChangeMode", gameObject);
                    return(true);
                });
            }
        }
    }
コード例 #4
0
    public bool Update()
    {
        bool ret = false;

        if ((currentState == State.Pressed) && (lastDown >= longClick / 2))
        {
            currentState = State.Hold;
        }

        if (Get())
        {
            ApplyOnce.apply("pressed", this, () =>
            {
                lastDown     = 0;
                currentState = State.Pressed;
                ret          = true;
                return(true);
            });
        }
        else
        {
            if (ApplyOnce.alreadyApplied("pressed", this))
            {
                if (lastDown >= longClick)
                {
                    currentState = State.Long;
                }
                else
                {
                    currentState = State.Short;
                }
                ApplyOnce.remove("pressed", this);
            }
            else
            {
                currentState = State.None;
                requester    = null;
            }
        }

        lastDown++;
        return(ret);
    }
コード例 #5
0
    private void SetActors()
    {
        foreach (KeyValuePair <Commandments.Shrines, GameObject> element in onScene)
        {
            //Debug.Log("Clearing shrine " + element.Key);
            Shrine shrine = element.Value.GetComponent <Shrine>();
            if (shrine)
            {
                shrine.Clear();
            }
        }

        Vector3 tempVect = onScene[destinyShrine].transform.position;

        tempVect.z = player.transform.position.z;
        player.transform.position = tempVect;
        playerScript.ResetLerp();
        playerScript.Reload();
        gameManager.getCurrentCamera().InstantChangeLocation(player);
        //msg = "New Player position: " + player.transform.position;

        if (warpImage)
        {
            if (ApplyOnce.alreadyApplied("Reload", gameObject))
            {
                startTime = transitionTime - 1;
            }
            else
            {
                //startTime = 0;
                //startTime = DEBUG_asd;
                for (startTime = 0; startTime < 2; startTime++)
                {
                    UpdateCircleSimplified();
                }
            }
        }

        ApplyOnce.remove("notifyAsderek", gameObject);
        ApplyOnce.remove("ScreenShot", gameObject);
    }
コード例 #6
0
 public void SetShrineImage(SpriteRenderer displayImg)
 {
     ApplyOnce.remove("Exit", gameObject);
     currentImg = displayImg;
     UpdateScenes();
 }
コード例 #7
0
    // Update is called once per frame
    void Update()
    {
        if (!receivePing)
        {
            return;
        }


        size = (int)((1f / ThetaScale) + 1f);



        float startAngle = (echoDirection - echoAngle / 2f) % 360;
        float endAngle   = (echoDirection + echoAngle / 2f) % 360;

        startAngle += (startAngle < 0) ? 360 : 0;
        endAngle   += (startAngle < 0) ? 360 : 0;

        int startIndex = (int)((startAngle / 360f) * size);
        int finalIndex = (int)((endAngle / 360f) * size);

        if (finalIndex > startIndex)
        {
            size = finalIndex - startIndex + 1;
        }
        else
        {
            size = size - startIndex + finalIndex;
        }

        LineDrawer.positionCount = size;

        Theta = startIndex * (2.0f * Mathf.PI * ThetaScale);
        for (int i = 0; i < size; i++)
        {
            Theta += (2.0f * Mathf.PI * ThetaScale);
            float x = radius * Mathf.Cos(Theta) + transform.position.x;
            float y = radius * Mathf.Sin(Theta) + transform.position.y;
            LineDrawer.SetPosition(i, new Vector3(x, y, 0));
        }


        if (radius > maxRadiusSize)
        {
            if (parent)
            {
                radius      = startRadius;
                receivePing = false;
                parent      = false;
                GetComponent <CircleCollider2D>().enabled = true;
                LineDrawer.positionCount = 0;
                GameObject son = Instantiate(gameObject, transform.position, Quaternion.identity);
                son.transform.localScale = transform.lossyScale;
                son.transform.parent     = transform.parent;
            }
            ApplyOnce.remove(applyString, gameObject);
            Destroy(gameObject);
        }
        else
        {
            radius += radiusFactor;
        }
    }
コード例 #8
0
    protected virtual string  Running()
    {
        float  direction;
        string nextState;

        if (isOnWall)
        {
            ApplyOnce.apply(ao_turnSentry, gameObject, () =>
            {
                TurnCharacter((Direction)(-getDirection()));
                AchieveMaxSpeed(maxSpeed);
                return(true);
            });
            AchieveMaxSpeed(maxSpeed);
            return("activateRunning");
        }

        if (!isOnGround)
        {
            nextState = LeaveGround();
            if (nextState != null)
            {
                return(nextState);
            }
        }
        if (isOnLedge)
        {
            nextState = OnLedge();
            if (nextState != null)
            {
                return(nextState);
            }
        }
        ApplyOnce.remove(ao_turnSentry, gameObject);



        string ret = DecideAttack();

        if (ret != null)
        {
            return(ret);
        }

        if (isOnRange(viewRange)) //se o player está na distancia de chasing
        {
            nextState = BeginChase();
            if (nextState != null)
            {
                return(nextState);
            }
        }

        float CurrentDistance = transform.position.x - initialPosition;

        direction = (((int)transform.eulerAngles.y) / -90) + 1; /*+1 right -1 left*/

        nextState = "activateRunning";



        if (direction * CurrentDistance > (scoutRange + AUXRANGE))
        {
            transform.eulerAngles = new Vector2(0, (direction + 1) * 90);
        }
        else if (direction * CurrentDistance > (scoutRange))
        {
            transform.eulerAngles = new Vector2(0, (direction + 1) * 90);
            if (direction > 0)
            {
                nextState = "activateSitting";
            }
            else
            {
                nextState = "activateChilling";
            }
        }

        AchieveMaxSpeed(maxSpeed);

        return(nextState);
    }