예제 #1
0
    /// <summary>
    /// Deposesses without changing the player's position.
    /// </summary>
    public void OnDeposessWOPos(Vector2 pos)
    {
        if (CurrentNode != null)
        {
            if (CurrentNode.COLTYPE == (int)COLLISION_T.NO_DEPOSEESS ||
                CurrentNode.COLTYPE == (int)COLLISION_T.DITCH ||
                CurrentNode.COLTYPE == (int)COLLISION_T.FALLING ||
                CurrentNode.COLTYPE == (int)COLLISION_T.FALLING_ON_LAND ||
                CurrentNode.COLTYPE == (int)COLLISION_T.WATER_TILE ||
                CurrentNode.COLTYPE == (int)COLLISION_T.WALL)
            {
                o_popup pop = s_leveledit.LevEd.SpawnObject <o_popup>("thought", transform);
                pop.parent = this;
                pop.timer  = 1.6f;
                return;
            }
        }
        o_plcharacter pl = s_levelloader.LevEd.player.GetComponent <o_plcharacter>();

        pl.transform.position = pos;
        pl.gameObject.SetActive(true);
        transform.SetParent(GameObject.Find("Entities").transform);
        gameObject.layer = 13;
        AI = true;
        //s_leveledit.LevEd.ChangeCharacterPossesData(name, false);
        pl.CHARACTER_STATE = CHARACTER_STATES.STATE_IDLE;
        MagnumFoudation.s_camera.SetPlayer(pl);
        pl.host    = null;
        pl.control = true;
        pl.SpriteObj.GetComponent <SpriteRenderer>().color = Color.white;
        if (respawnOnDeposess)
        {
            StartCoroutine(Unconsious());
        }
    }
예제 #2
0
    public override void PlayerControl()
    {
        if (CurrentNode != null)
        {
            switch ((COLLISION_T)CurrentNode.COLTYPE)
            {
            default:
                if (pop2 != null)
                {
                    pop2.DespawnObject();
                }
                textshow = false;
                break;

            case COLLISION_T.LANDING_DOWN:
            case COLLISION_T.LANDING_LEFT:
            case COLLISION_T.LANDING_RIGHT:
            case COLLISION_T.LANDING_UP:

                if (!textshow)
                {
                    pop2             = s_leveledit.LevEd.SpawnObject <o_popup>("thought", transform);
                    pop2.parent      = this;
                    pop2.timed       = false;
                    pop2.offsetPos   = 50;
                    textshow         = true;
                    pop2.typeOfThing = o_popup.NOTTYPE.JUMPOFF;
                }
                break;
            }
        }
        switch (CHARACTER_STATE)
        {
        case CHARACTER_STATES.STATE_IDLE:
            if (ArrowKeyControl())
            {
                CHARACTER_STATE = CHARACTER_STATES.STATE_MOVING;
            }
            break;

        case CHARACTER_STATES.STATE_MOVING:
            if (!ArrowKeyControl())
            {
                CHARACTER_STATE = CHARACTER_STATES.STATE_IDLE;
            }
            break;
        }
        base.PlayerControl();
    }