コード例 #1
0
    public override void ActivateInteraction()
    {
        base.ActivateInteraction();
        player.GetComponent <Asderek>().LerpToPosition(transform.position);

        ApplyOnce.apply("Interact", gameObject, () => { return(true); });


        /*
         * if (id == Commandments.Shrines.FIRE_STAGE_1)
         *  load.loadShrine(Commandments.Shrines.FIRE_STAGE_2);
         * else if (id== Commandments.Shrines.FIRE_STAGE_2)
         *  load.loadShrine(Commandments.Shrines.NEXUS);
         * else if (id == Commandments.Shrines.NEXUS)
         *  load.loadShrine(Commandments.Shrines.FIRE_STAGE_1);
         */
    }
コード例 #2
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);
                });
            }
        }
    }
コード例 #3
0
    void Update()
    {
        ApplyOnce.apply("StartGame", gameObject, () => {
            uiManager = UIManager.GetInstance();
            UpdateLanguage();
            return(true);
        });

        //if(Input.GetButtonUp("SELECT"))
        //{
        //    if (saveIndex >= 0) {
        //        saveJson.saves[saveIndex].saveGame();
        //        saveJson.config.lastSave = saveIndex;
        //        saveJson.Save("save.json");
        //    }
        //}
    }
コード例 #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
    void OnTriggerEnter2D(Collider2D colisor)
    {
        if (colisor.gameObject.GetComponent <Sonar>() != null)
        {
            ApplyOnce.apply(applyString, gameObject, () =>
            {
                LineDrawer.startColor = colisor.gameObject.GetComponent <LineRenderer>().startColor;
                LineDrawer.endColor   = colisor.gameObject.GetComponent <LineRenderer>().endColor;


                Vector2 aux = colisor.transform.position - transform.position;

                echoDirection = Mathf.Rad2Deg * Mathf.Atan2(aux.y, aux.x);

                receivePing = true;

                GetComponent <CircleCollider2D>().enabled = false;



                LineDrawer.startWidth = LineDrawer.endWidth = LineDrawer.startWidth / 7;
                Instantiate(gameObject, transform.position, Quaternion.identity);
                LineDrawer.startWidth = LineDrawer.endWidth = LineDrawer.startWidth * 7;
                radius = 2 * radiusFactor;
                LineDrawer.startWidth = LineDrawer.endWidth = LineDrawer.startWidth / 2;
                Instantiate(gameObject, transform.position, Quaternion.identity);
                LineDrawer.startWidth = LineDrawer.endWidth = LineDrawer.startWidth * 2;
                radius = 4 * radiusFactor;

                parent = true;


                return(true);
            });
        }
    }
コード例 #6
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);
    }