// Use this for initialization
	public void Init (EntranceInfo mEntrance,FestivalUser data) {
		currentPoint = 0;
		entrance = mEntrance;
		mState = FestivalUserState.FollowingDirection;
		currentDirection = mEntrance.entranceDirection;
		transform.up = currentDirection;
		_Data = data;
		followPoints = new List<Vector2> ();

		InitLine ();
		StartCoroutine ("FollowBehaviour");

		mSkeletonAnimation.state.SetAnimation (0,_Data.animInfo.walk_anim, true);
		nameLabel = (Instantiate (nameLabel_prefab) as GameObject).GetComponent<UILabel> ();
		nameLabel.GetComponent<FollowPlayer> ().target = transform;
		nameLabel.text = _Data.name;

		controlState = UserControlState.Continue;
	}
Beispiel #2
0
    // Use this for initialization
    public void Init(EntranceInfo mEntrance, FestivalUser data)
    {
        currentPoint     = 0;
        entrance         = mEntrance;
        mState           = FestivalUserState.FollowingDirection;
        currentDirection = mEntrance.entranceDirection;
        transform.up     = currentDirection;
        _Data            = data;
        followPoints     = new List <Vector2> ();

        InitLine();
        StartCoroutine("FollowBehaviour");

        mSkeletonAnimation.state.SetAnimation(0, _Data.animInfo.walk_anim, true);
        nameLabel = (Instantiate(nameLabel_prefab) as GameObject).GetComponent <UILabel> ();
        nameLabel.GetComponent <FollowPlayer> ().target = transform;
        nameLabel.text = _Data.name;

        controlState = UserControlState.Continue;
    }
	public void OnContinue(){
		controlState = UserControlState.Continue;
		mSkeletonAnimation.state.SetAnimation (0,_Data.animInfo.walk_anim, true);

	}
	public void OnStop(){
		mSkeletonAnimation.state.SetAnimation (0,_Data.animInfo.idle_anim, true);

		controlState = UserControlState.Stopped;

	}
 void Awake()
 {
     UCState = new UserControlState(transform);
     this.AddState(new GroundedState(), new JumpState(), new FlyingState());
     this.ChangeState("Grounded", UCState);
 }
Beispiel #6
0
    /// <summary>
    /// Draws a box of specified size (Vector2, Vector2) in specified skin and state
    /// </summary>
    /// <param id="position"></param>
    /// <param id="size"></param>
    /// <param id="skin"></param>
    /// <param id="state"></param>
    public void DrawBox(Vector2 position, Vector2 size, GUITexture skin, UserControlState state)
    {
      int widthBorder = skin.WidthBorder;
      int heightBorder = skin.HeightBorder;

      Vector2 posTopLeft = position;
      Vector2 posTopCenter = position + new Vector2(widthBorder, 0);
      Vector2 sizTopCenter = new Vector2(size.X - 2 * widthBorder, heightBorder);
      Vector2 posTopRight = position + new Vector2(size.X - widthBorder, 0);

      Vector2 posLeft = position + new Vector2(0, heightBorder);
      Vector2 sizLeft = new Vector2(widthBorder, size.Y - 2 * heightBorder);
      Vector2 posCenter = position + new Vector2(widthBorder, heightBorder);
      Vector2 sizCenter = size - new Vector2(2 * widthBorder, 2 * heightBorder);
      Vector2 posRight = position + new Vector2(size.X - widthBorder, heightBorder);
      Vector2 sizRight = new Vector2(widthBorder, size.Y - 2 * heightBorder);

      Vector2 posBottomLeft = position + new Vector2(0, size.Y - heightBorder);
      Vector2 posBottomCenter = position + new Vector2(widthBorder, size.Y - heightBorder);
      Vector2 sizBottomCenter = new Vector2(size.X - 2 * widthBorder, heightBorder);
      Vector2 posBottomRight = position + new Vector2(size.X - widthBorder, size.Y - heightBorder);

      sb.Draw(skin.GetTexture(Direction.TopLeft, state), posTopLeft, null, Color.White, 0f, Vector2.Zero, 1f, 0, 1f);
      sb.Draw(skin.GetTexture(Direction.Top, state), UI.MakeRect(posTopCenter, sizTopCenter), null, Color.White, 0f, Vector2.Zero, 0, 1f);
      sb.Draw(skin.GetTexture(Direction.TopRight, state), posTopRight, null, Color.White, 0f, Vector2.Zero, 1f, 0, 1f);

      sb.Draw(skin.GetTexture(Direction.Left, state), UI.MakeRect(posLeft, sizLeft), null, Color.White, 0f, Vector2.Zero, 0, 1f);
      sb.Draw(skin.GetTexture(Direction.Center, state), UI.MakeRect(posCenter, sizCenter), null, Color.White, 0f, Vector2.Zero, 0, 1f);
      sb.Draw(skin.GetTexture(Direction.Right, state), UI.MakeRect(posRight, sizRight), null, Color.White, 0f, Vector2.Zero, 0, 1f);

      sb.Draw(skin.GetTexture(Direction.BottomLeft, state), posBottomLeft, null, Color.White, 0f, Vector2.Zero, 1f, 0, 1f);
      sb.Draw(skin.GetTexture(Direction.Bottom, state), UI.MakeRect(posBottomCenter, sizBottomCenter), null, Color.White, 0f, Vector2.Zero, 0, 1f);
      sb.Draw(skin.GetTexture(Direction.BottomRight, state), posBottomRight, null, Color.White, 0f, Vector2.Zero, 1f, 0, 1f);
    }
Beispiel #7
0
 public void OnContinue()
 {
     controlState = UserControlState.Continue;
     mSkeletonAnimation.state.SetAnimation(0, _Data.animInfo.walk_anim, true);
 }
Beispiel #8
0
    public void OnStop()
    {
        mSkeletonAnimation.state.SetAnimation(0, _Data.animInfo.idle_anim, true);

        controlState = UserControlState.Stopped;
    }
Beispiel #9
0
 /// <summary>
 /// Returns the part of the texture for given state
 /// </summary>
 /// <param id="texturePart">Part of the texture</param>
 /// <param id="state">User control state</param>
 /// <returns>Individual part of user control texture for given state</returns>
 public Texture2D GetTexture(Direction texturePart, UserControlState state)
 {
   return textures[(int)state, (int)texturePart];
 }