public void EnterStage(string pose, StageDistance distance, StagePosition facing, bool Skip)
    {
        Start(); // just incase this gets called before start, somehow;



        visual.sprite = GetPose(pose);
        ChangeDistance(distance);
        ChangeFacing(facing);


        var awhite = Color.white;

        awhite.a = 0;

        if (Skip)
        {
            visual.color     = Color.white;
            BackSprite.color = awhite;
        }
        else
        {
            Entering         = true;
            visual.color     = awhite;
            BackSprite.color = awhite;
            //visual.gameObject.DispatchEvent(Events.Fade, new FadeEvent(Color.white, SpriteSwitchSpeed));
        }
    }
Beispiel #2
0
        int CountCharactersOnSide(StagePosition position)
        {
            Debug.Log($"CountCOS fired. StagePosition is {position}");
            int count = 0;
            int side  = 0;

            if (position == StagePosition.left)
            {
                side = -1;
            }
            else if (position == StagePosition.right)
            {
                side = 1;
            }
            else
            {
                Debug.Log($"CountCOS returned without counting");
                return(0);
            }

            RectTransform characterPanel = (RectTransform)GameObject.Find("CharacterPanel").transform;

            foreach (RectTransform child in characterPanel)
            {
                if (child.anchoredPosition.x * side > 0)
                {
                    count += 1;
                    Debug.Log($"Child.anchoredPosition.x is {child.anchoredPosition.x} side modifier is {side} and side/position is {position}");
                }
            }

            return(count);
        }
    void OnNewLine(DescriptionEvent eventdata)
    {
        if (eventdata.Speaker == "")
        {
            return;
        }

        if (Actors.ContainsKey(eventdata.TrueSpeaker.ToLower()))
        {
            StagePosition pos = Actors[eventdata.TrueSpeaker.ToLower()];
            GetComponent <Animator>().SetBool("Skipping", IsSkipping);
            switch (pos)
            {
            case StagePosition.Left:
                GetComponent <Animator>().SetInteger("Position", 0);
                break;

            case StagePosition.Center:
                GetComponent <Animator>().SetInteger("Position", 1);
                break;

            case StagePosition.Right:
                GetComponent <Animator>().SetInteger("Position", 2);
                break;

            default:
                GetComponent <Animator>().SetInteger("Position", 0);
                break;
            }
        }
        else
        {
            GetComponent <Animator>().SetInteger("Position", 0);
        }
    }
Beispiel #4
0
        // TODO // deal with placing more than one character on the same side of the screen
        // it will calculate the position on the screen based on the number of characters on that side of the screen
        // will it reposition existing characters or just put the new one in place in some kind of set order.
        // [.5f, .33f, .66f, .2f, .8f, .125f, .875f]
        public void MoveTo(RectTransform RT, StagePosition newPosition, int numCharacters = 0)
        {
            float spriteWidth = RT.sizeDelta.x;
            float margin      = (ScreenWidth - spriteWidth) / 2;
            float distance;

            float[] scale = new float[] { .66f, .33f, .2f, .8f, .125f, .875f };
            switch (newPosition)
            {
            case StagePosition.offStage:
                RT.anchoredPosition = new Vector2(0f, -10000f);
                break;

            case StagePosition.center:
                RT.anchoredPosition = new Vector2(0f, 0f);
                break;

            case StagePosition.right:
                distance            = margin * scale[numCharacters];
                RT.anchoredPosition = new Vector2(distance, 0f);
                break;

            case StagePosition.left:
                distance            = margin * scale[numCharacters];
                RT.anchoredPosition = new Vector2(-distance, 0f);
                break;
            }
            ;
        }
Beispiel #5
0
    void Start()
    {
        Stage5Pos = FindObjectOfType <StagePosition>().GetComponent <StagePosition>();
        ObjLife   = GetComponent <ObjectLife>();
        ani       = GetComponent <Animator>();
        NCommand  = GetComponent <NatureCommand>();
        BCommand  = GetComponent <BattleCommand>();
        Player    = GameObject.FindWithTag("Player").GetComponent <Transform>();

        //가져와서 적용해야 할 부분
        msg = new MoveMsg();
        //가져와서 적용해야 할 부분


        Battle = new Queue();
        Peace  = new Queue();
        for (int i = 0; i < BasicPeace.Length; ++i)
        {
            Peace.Enqueue(BasicPeace [i]);
        }
        for (int i = 0; i < BasicBattle.Length; ++i)
        {
            Battle.Enqueue(BasicBattle [i]);
        }
        //while (Peace.Count > 0) {
        //	Debug.Log (Peace.Dequeue ());
        //}
        StartCoroutine("AISearching");
    }
    public void ExitStage(StagePosition direction, bool Skip)
    {
        //visual.sprite = Poses[pose];
        var awhite = Color.white;

        awhite.a = 0;

        if (Skip)
        {
            visual.color = awhite;
            Destroy(gameObject, 0.5f);
            return;
        }

        visual.gameObject.DispatchEvent(Events.Fade, new FadeEvent(awhite, SpriteSwitchSpeed));
        var pos = transform.position;

        if (direction == StagePosition.Left)
        {
            pos.x -= 2.5f;
        }
        else if (direction == StagePosition.Right)
        {
            pos.x += 2.5f;
        }
        iTween.MoveTo(gameObject, pos, 2);
        Destroy(gameObject, 5);
    }
Beispiel #7
0
 public CastDirectionEvent(string person, string pose = "", StageDistance Dis = StageDistance.Center, StagePosition Pos = StagePosition.Center, StagePosition face = StagePosition.Right)
 {
     character       = person;
     Pose            = pose;
     Direction       = Pos;
     Distance        = Dis;
     FacingDirection = face;
 }
Beispiel #8
0
    public CastDirectionEvent(string person, string calls)
    {
        character = person;
        Pose      = "None";

        string[] directions = calls.Split(',');

        foreach (string call in directions)
        {
            //MonoBehaviour.print(call);
            var calling = call.Replace(" ", "");

            switch (calling.ToLower())
            {
            case "exit":
                Exiting = true;
                break;

            case "left":
                FacingDirection = StagePosition.Left;
                break;

            case "right":
                FacingDirection = StagePosition.Right;
                break;

            case "close":
                Distance = StageDistance.Close;
                break;

            case "medium":
                Distance = StageDistance.Center;
                break;

            case "far":
                Distance = StageDistance.Far;
                break;

            case "stage_right":
                Direction = StagePosition.Right;
                break;

            case "stage_left":
                Direction = StagePosition.Left;
                break;

            case "stage_center":
                Direction = StagePosition.Center;
                break;

            default:
                Pose = calling;
                break;
            }
        }
    }
 public CharacterIntermission(CharacterIntermission copy_)
 {
     chara = copy_.chara;
     Dir   = copy_.Dir;
     face  = copy_.face;
     Dis   = copy_.Dis;
     PosX  = copy_.PosX;
     PosY  = copy_.PosY;
     Name  = copy_.Name;
 }
Beispiel #10
0
    public void DoOutro(Character character)
    {
        if (character.Has(Character.Left) && LeftStagePos == StagePosition.OnStage)
        {
            leftCharacterAnimator.SetTrigger(OutroAnimation);
            LeftStagePos = StagePosition.OffStage;
        }

        if (character.Has(Character.Right) && RightStagePos == StagePosition.OnStage)
        {
            rightCharacterAnimator.SetTrigger(OutroAnimation);
            RightStagePos = StagePosition.OffStage;
        }
    }
Beispiel #11
0
    public void DoIntro(Character character)
    {
        Debug.Log("For " + character + ", Has: " + character.Has(Character.Left) + ", " + character.Has(Character.Right));
        if (character.Has(Character.Left) && LeftStagePos == StagePosition.OffStage)
        {
            leftCharacterAnimator.SetTrigger(IntroAnimation);
            LeftStagePos = StagePosition.OnStage;
        }

        if (character.Has(Character.Right) && RightStagePos == StagePosition.OffStage)
        {
            rightCharacterAnimator.SetTrigger(IntroAnimation);
            RightStagePos = StagePosition.OnStage;
        }
    }
Beispiel #12
0
	public static int get_Direction(IntPtr l)
	{
		int result;
		try
		{
			StagePosition stagePosition = (StagePosition)LuaObject.checkSelf(l);
			LuaObject.pushValue(l, true);
			LuaObject.pushValue(l, stagePosition.Direction);
			result = 2;
		}
		catch (Exception e)
		{
			result = LuaObject.error(l, e);
		}
		return result;
	}
Beispiel #13
0
	public static int constructor(IntPtr l)
	{
		int result;
		try
		{
			StagePosition o = new StagePosition();
			LuaObject.pushValue(l, true);
			LuaObject.pushValue(l, o);
			result = 2;
		}
		catch (Exception e)
		{
			result = LuaObject.error(l, e);
		}
		return result;
	}
Beispiel #14
0
	public static int set_PositionType(IntPtr l)
	{
		int result;
		try
		{
			StagePosition stagePosition = (StagePosition)LuaObject.checkSelf(l);
			StagePositionType positionType;
			LuaObject.checkEnum<StagePositionType>(l, 2, out positionType);
			stagePosition.PositionType = positionType;
			LuaObject.pushValue(l, true);
			result = 1;
		}
		catch (Exception e)
		{
			result = LuaObject.error(l, e);
		}
		return result;
	}
Beispiel #15
0
    public void SetCharacters(StoryCharacter leftCharacter, StoryCharacter rightCharacter)
    {
        if (leftCharacter)
        {
            this.leftCharacter.sprite        = leftCharacter.NeutralSprites.Normal;
            this.leftCharacterTalking.sprite = leftCharacter.NeutralSprites.Talking;
            LeftCharacterCache = leftCharacter;
            LeftStagePos       = StagePosition.OffStage;
        }

        if (rightCharacter)
        {
            this.rightCharacter.sprite        = rightCharacter.NeutralSprites.Normal;
            this.rightCharacterTalking.sprite = rightCharacter.NeutralSprites.Talking;
            RightCharacterChache = rightCharacter;
            RightStagePos        = StagePosition.OffStage;
        }
    }
Beispiel #16
0
	public static int set_Hero(IntPtr l)
	{
		int result;
		try
		{
			StagePosition stagePosition = (StagePosition)LuaObject.checkSelf(l);
			BattleHero hero;
			LuaObject.checkType<BattleHero>(l, 2, out hero);
			stagePosition.Hero = hero;
			LuaObject.pushValue(l, true);
			result = 1;
		}
		catch (Exception e)
		{
			result = LuaObject.error(l, e);
		}
		return result;
	}
Beispiel #17
0
	public static int set_PlayerIndex(IntPtr l)
	{
		int result;
		try
		{
			StagePosition stagePosition = (StagePosition)LuaObject.checkSelf(l);
			int playerIndex;
			LuaObject.checkType(l, 2, out playerIndex);
			stagePosition.PlayerIndex = playerIndex;
			LuaObject.pushValue(l, true);
			result = 1;
		}
		catch (Exception e)
		{
			result = LuaObject.error(l, e);
		}
		return result;
	}
Beispiel #18
0
	public static int set_Position(IntPtr l)
	{
		int result;
		try
		{
			StagePosition stagePosition = (StagePosition)LuaObject.checkSelf(l);
			GridPosition position;
			LuaObject.checkValueType<GridPosition>(l, 2, out position);
			stagePosition.Position = position;
			LuaObject.pushValue(l, true);
			result = 1;
		}
		catch (Exception e)
		{
			result = LuaObject.error(l, e);
		}
		return result;
	}
    public void ChangeFacing(StagePosition pos)
    {
        if (pos == StagePosition.None)
        {
            return;
        }

        FacingDirection = pos;

        print(Character.Character + ", " + FacingDirection);

        if (FlipOnLeft)
        {
            if (FacingDirection == StagePosition.Right)
            {
                visual.flipX     = false;
                BackSprite.flipX = false;
            }
            else
            {
                visual.flipX     = true;
                BackSprite.flipX = true;
            }
        }
        else
        {
            if (FacingDirection == StagePosition.Right)
            {
                visual.flipX     = true;
                BackSprite.flipX = true;
            }
            else
            {
                visual.flipX     = false;
                BackSprite.flipX = false;
            }
        }
    }
Beispiel #20
0
    void HopAnimation()
    {
        StagePosition hop = (StagePosition)Random.Range(0, System.Enum.GetValues(typeof(StagePosition)).Length);

        switch (hop)
        {
        case StagePosition.Left:
            if (trans.offsetMin.x < -Mathf.Abs(BoundsBuffer))
            {
                return;
            }

            trans.localScale = Vector3.one;
            AnimationCurve curve = HopCurves[Random.Range(0, HopCurves.Length)];
            StartCoroutine(Animate(curve, -HopDistance));
            break;

        case StagePosition.Right:
            if (trans.offsetMax.x > Mathf.Abs(BoundsBuffer))
            {
                return;
            }

            trans.localScale = new Vector3(-1, 1, 1);
            AnimationCurve curve2 = HopCurves[Random.Range(0, HopCurves.Length)];
            StartCoroutine(Animate(curve2, HopDistance));
            break;

        case StagePosition.Center:
            AnimationCurve curve3 = HopCurves[Random.Range(0, HopCurves.Length)];
            StartCoroutine(Animate(curve3, 0));
            break;

        default:
            break;
        }
    }
Beispiel #21
0
 // Constructor for stage directions
 public Command(CommandName name, CharName character, StagePosition position)
 {
     CommandName = name;
     Character   = character;
     Position    = position;
 }
Beispiel #22
0
    void UpdateStagePositions(StagePosition pos)
    {
        int   i           = 0;
        var   spot        = new Vector3();
        float CenterPoint = 0;
        float Spacing     = 0;

        switch (pos)
        {
        case StagePosition.Center:
            spot        = gameObject.transform.localPosition;
            CenterPoint = 0.5f;
            break;

        case StagePosition.Left:
            spot        = LeftSpot.transform.localPosition;
            CenterPoint = 1 / 4;
            break;

        case StagePosition.Right:
            spot        = RightSpot.transform.localPosition;
            CenterPoint = 3 / 4;
            break;

        default:
            break;
        }

        //if the number of people in that spot is more than the spacing given allows
        if (Varience * SpotLights[pos] > SpotSize + 1)
        {
            Spacing = SpotSize / SpotLights[pos];
            spot.x -= SpotSize * CenterPoint;
            print(SpotSize);
        }
        else if (SpotLights[pos] != 1)
        {
            Spacing = Varience;
            spot.x -= (Varience * (SpotLights[pos] - 1)) / 2;
        }


        foreach (var Roll in Actors)
        {
            if (Roll.Direction == pos)
            {
                spot.z = Roll.transform.localPosition.z;
                spot.y = Roll.transform.localPosition.y;

                if (!Skip)
                {
                    Roll.MoveOnStage(spot, SpriteMoveTime);
                }
                else
                {
                    Roll.transform.localPosition = spot;
                }

                spot.x += Spacing;
                i      += 1;
                if (i >= SpotLights[pos])
                {
                    return;
                }
            }
        }
    }