コード例 #1
0
    void Update()
    {
        if (Input.GetMouseButtonUp(0))
        {
            if (!itemClicked && currentGamestate == gamestate.game || releasedMouse == true && currentGamestate == gamestate.game)
            {
                MovePlayer(Input.mousePosition);
                selectedItem = null;
            }
            Cursor.SetCursor(mouseUp, new Vector2(0, 0), CursorMode.Auto);
        }

        if (Input.GetMouseButtonDown(0))
        {
            Cursor.SetCursor(mouseDown, new Vector2(0, 0), CursorMode.Auto);
        }

        if (itemClicked)
        {
            if (Vector2.Distance(new Vector2(itemClicked.interactPosition.position.x, itemClicked.interactPosition.position.z), new Vector2(transform.position.x, transform.position.z)) < 0.2f)
            {
                MakeTalk();
                itemClicked.StartInspection();
                itemClicked = null;
            }
        }

        if (!footLeft && !footLeft.GetComponent <iTween>() && !footRight.GetComponent <iTween>() || currentMoveState == movestate.idle)
        {
            return;
        }

        if (playerAgent && !playerAgent.pathPending)
        {
            if (playerAgent.remainingDistance <= playerAgent.stoppingDistance)
            {
                if (!playerAgent.hasPath || playerAgent.velocity.sqrMagnitude == 0f)
                {
                    CancelInvoke("MoveRightFoot");

                    /* //stop walking
                     * if(footLeft.GetComponent<iTween>())
                     *   footLeft.GetComponent<iTween>().on
                     *
                     * if(footRight.GetComponent<iTween>())
                     *   footRight.GetComponent<iTween>().loopType = iTween.LoopType.none;*/

                    currentMoveState = movestate.idle;
                }
            }
        }
    }
コード例 #2
0
    public void MoveLeftFoot()
    {
        if (!playerAgent)
        {
            return;
        }

        if (currentMoveState == movestate.walking)
        {
            return;
        }

        currentMoveState = movestate.walking;

        iTween.MoveTo(footLeft, iTween.Hash("position", new Vector3(footLeft.transform.localPosition.x + 0.07f, 0, footLeft.transform.localPosition.z + 0.07f), "islocal", true, "time", 0.3f, "looptype", iTween.LoopType.pingPong, "easetype", iTween.EaseType.linear, "oncomplete", "CheckIdleLeft", "oncompletetarget", gameObject));
        Invoke("MoveRightFoot", 0.3f);
    }
コード例 #3
0
ファイル: global_variables.cs プロジェクト: jbornemann/Ascian
    public global_vars(GraphicsDeviceManager m)
    {
        screen_height = m.GraphicsDevice.Viewport.Height;
        screen_width = m.GraphicsDevice.Viewport.Width;

        CHARACTER_HEIGHT = screen_height / 16;
        CHARACTER_WIDTH =  screen_width / 16;
        ENEMY_HEIGHT = screen_height / 32;
        ENEMY_WIDTH = screen_width / 30;
        SHADOW_HEIGHT = screen_height / 16;
        SHADOW_WIDTH = screen_width / 15;
        CHARACTER_UPDATE_PRIORITY = 1;
        ABILITY_UPDATE_PRIORITY = 0;
        ENEMY_UPDATE_PRIORITY = 2;
        CHARACTER_START_POSITION = new Point(screen_width / 2, screen_height / 2);
        CHARACTER_DEFAULT_MOVE_SPEED = 3;
        ENEMY_MOVE_SPEED = 1;
        CHARACTER_DEFAULT_MOVESTATE = movestate.notmoving;

        ENEMY_SPAWN_POSITIONS = new Point[12];
        //centers
        ENEMY_SPAWN_POSITIONS[0] = new Point(screen_width /2 , -CHARACTER_HEIGHT);
        ENEMY_SPAWN_POSITIONS[1] = new Point(-CHARACTER_WIDTH, screen_height / 2);
        ENEMY_SPAWN_POSITIONS[2] = new Point(screen_width + CHARACTER_WIDTH, screen_height / 2);
        ENEMY_SPAWN_POSITIONS[3] = new Point(screen_width / 2, screen_height + CHARACTER_HEIGHT);
        //corners
        ENEMY_SPAWN_POSITIONS[4] = new Point(0, 0);
        ENEMY_SPAWN_POSITIONS[5] = new Point(screen_width, screen_height);
        ENEMY_SPAWN_POSITIONS[6] = new Point(screen_width, 0);
        ENEMY_SPAWN_POSITIONS[7] = new Point(0, screen_height);
        //between corners and centers
        ENEMY_SPAWN_POSITIONS[8] = new Point(screen_width / 4, -CHARACTER_HEIGHT);
        ENEMY_SPAWN_POSITIONS[9] = new Point((screen_width / 2) + (screen_width / 4), -CHARACTER_HEIGHT);
        ENEMY_SPAWN_POSITIONS[10] = new Point((screen_width / 4), screen_height + CHARACTER_HEIGHT);
        ENEMY_SPAWN_POSITIONS[11] = new Point((screen_width / 2) + (screen_width / 4), screen_height + CHARACTER_HEIGHT);

        SHIELD_HEIGHT = 200;
        SHIELD_WIDTH = 200;

        ATTACK_SPELL_SIZE = 20;
        ATTACK_SPELL_SPEED = 25;
        ATTACK_DELAY = 250;

        SHADOW_START = 120000;
        SPECIAL_ABILITY_NUMBER = 3;
        HUDLOC = new Vector2(screen_height / 10, screen_width / 10);
        PLOC = new Vector2(100, 70);
        CLOC = new Vector2(100, 160);

        MENU_DELAY = 7;
        PAUSE_DELAY = 1000;
        UPGRADE_DELAY = 100;

        NO_ABILITY = "none";
        ABIL_ONE = "fire";
        ABIL_TWO = "ice";
        ABIL_THREE = "smoke";
        ONE_COST = 100;
        TWO_COST = 100;
        THREE_COST = 100;

        manager = m;
    }
コード例 #4
0
 public void StopMoving()
 {
     currentGamestate      = gamestate.inventory;
     playerAgent.isStopped = true;
     currentMoveState      = movestate.idle;
 }