Beispiel #1
0
    // Create all objects for the 'walking man' stage
    void WalkingBlueManStage()
    {
        // To create the background lets create a filled sprite object
        back = OT.CreateObject(OTObjectType.FilledSprite).GetComponent <OTFilledSprite>();
        // Set the image to our wyrmtale tile
        back.image = whiteTile;
        // But this all the way back so all other objects will be located in front.
        back.depth = 1000;
        // Set material reference to 'custom' green material - check OT material references
        back.materialReference = "green";
        // Set the size to match the screen resolution.
        back.size = new Vector2(Screen.width, Screen.height);
        // Set the fill image size to 50 x 50 pixels
        back.fillSize = new Vector2(50, 50);

        // To create the walking man animation we first will have to create a sprite sheet
        OTSpriteSheet sheet = OT.CreateObject(OTObjectType.SpriteSheet).GetComponent <OTSpriteSheet>();

        // Link our walking man frames
        sheet.texture = walkingManAnimation;
        // specify the number or column and rows (frames) of this container
        sheet.framesXY = new Vector2(15, 8);

        // The next step is to create our animation object that will hold all
        // animation framesets (8 directions of walking) for our walking man
        OTAnimation animation = OT.CreateObject(OTObjectType.Animation).GetComponent <OTAnimation>();

        // Initialize our animation framesets so it can hold 8 framesets
        animation.framesets = new OTAnimationFrameset[8];
        // Add the 8 direction framesets
        animation.framesets[0] = WalkingFrameset("down", 1, sheet);
        animation.framesets[1] = WalkingFrameset("downLeft", 2, sheet);
        animation.framesets[2] = WalkingFrameset("left", 3, sheet);
        animation.framesets[3] = WalkingFrameset("upLeft", 4, sheet);
        animation.framesets[4] = WalkingFrameset("up", 5, sheet);
        animation.framesets[5] = WalkingFrameset("upRight", 6, sheet);
        animation.framesets[6] = WalkingFrameset("right", 7, sheet);
        animation.framesets[7] = WalkingFrameset("downRight", 8, sheet);
        // Give our animation a name
        animation.name = "walking-animation";

        // To put our walking man on screen we create an animting sprite object
        man = OT.CreateObject(OTObjectType.AnimatingSprite).GetComponent <OTAnimatingSprite>();
        // Set the size of our walking man
        man.size = new Vector2(40, 65);
        // Link our animation
        man.animation = animation;
        // Lets play a single frameset .. we start with 'down'
        man.animationFrameset = "down";
        // Auto-start to play this animation frameset
        man.playOnStart = true;
        // Give our sprite a name
        man.name = "man";

        // INFO : In this class Update() method, we will check the location of
        // the mouse pointer and play the corresponding direction animation
        // as we will set the right scroll speed for our background.
    }
Beispiel #2
0
 /// <summary>
 /// Plays a specific animation partly backward from a start frame to an end frame, starting after a delay.
 /// </summary>
 /// <param name="animation">Animation to play</param>
 /// <param name="startFrame">Animation frame number (from the back) where to start.</param>
 /// <param name="endFrame">Animation frame number (from the back) where to end.</param>
 /// <param name="delay">After this delay in seconds the animation will be started.</param>
 public void PlayBackward(OTAnimation animation, int startFrame, int endFrame, float delay)
 {
     if (animation != null)
     {
         this.animation         = animation;
         this.animationFrameset = "";
         PlayBackward(startFrame, endFrame, delay);
     }
 }
Beispiel #3
0
 /// <summary>
 /// Plays a specific animation backward.
 /// </summary>
 /// <param name="animation">Animation to play.</param>
 public void PlayBackward(OTAnimation animation)
 {
     if (animation != null)
     {
         this.animation         = animation;
         this.animationFrameset = "";
         PlayBackward();
     }
 }
Beispiel #4
0
 /// <summary>
 /// Plays a specific animation's frameset backward.
 /// </summary>
 /// <param name="animation">Animation to play a frameset from.</param>
 /// <param name="frameSet">Animation framset to play backward.</param>
 public void PlayBackward(OTAnimation animation, string frameSet)
 {
     if (animation != null)
     {
         this.animation         = animation;
         this.animationFrameset = frameSet;
         PlayBackward();
     }
 }
Beispiel #5
0
 /// <summary>
 /// Plays a specific animation backward starting at the start frame.
 /// </summary>
 /// <param name="animation">Animation to play.</param>
 /// <param name="startFrame">Animation frame number (from the back) where to start.</param>
 public void PlayBackward(OTAnimation animation, int startFrame)
 {
     if (animation != null)
     {
         this.animation         = animation;
         this.animationFrameset = "";
         PlayBackward(startFrame);
     }
 }
Beispiel #6
0
 // Use this for initialization
 public void Setup()
 {
     _animations = GameObject.Find("Frameworks/OT/Animations/player").GetComponent<OTAnimation>();
     _animSprite = GetComponentInChildren<OTAnimatingSprite>();
     _STATIC = "static";
     _WALK = "walk";
     _WALKFASTER = "walkfaster";
     _MAXWALK = "maxwalk";
     _CURR = "walk";
 }
Beispiel #7
0
 public static void RegisterAnimation(OTAnimation animation)
 {
     if (isValid)
         instance._RegisterAnimation(animation);
 }
Beispiel #8
0
 // Use this for initialization
 void Start()
 {
     _character 	= GetComponent<Character>();
     _player 	= GetComponent<Player>();
     anim = animSprite.animation;//GameObject.Find("Player/spriteParent/playerSprite-1").GetComponent<OTAnimatingSprite
 }
 /// <summary>
 /// Plays a specific animation partly backward from a start frame to an end frame, starting after a delay.
 /// </summary>
 /// <param name="animation">Animation to play</param>
 /// <param name="startFrame">Animation frame number (from the back) where to start.</param>
 /// <param name="endFrame">Animation frame number (from the back) where to end.</param>
 /// <param name="delay">After this delay in seconds the animation will be started.</param>
 public void PlayBackward(OTAnimation animation, int startFrame, int endFrame, float delay)
 {
     if (animation != null)
     {
         this.animation = animation;
         this.animationFrameset = "";
         PlayBackward(startFrame, endFrame, delay);
     }
 }
 /// <summary>
 /// Plays a specific animation's frameset backward.
 /// </summary>
 /// <param name="animation">Animation to play a frameset from.</param>
 /// <param name="frameSet">Animation framset to play backward.</param>
 public void PlayBackward(OTAnimation animation, string frameSet)
 {
     if (animation != null)
     {
         this.animation = animation;
         this.animationFrameset = frameSet;
         PlayBackward();
     }
 }
Beispiel #11
0
    TextMesh stagemesh2;                // textmesh for stage 1 menu item

    // Create all objects fo    r the star stage by code
    void AnimatingGreenStarStage()
    {
        // To create a scrolling background, first create a filled sprite object
        back = OT.CreateObject(OTObjectType.FilledSprite).GetComponent <OTFilledSprite>();
        // Set the image to the tile texture
        back.image = whiteTile;
        // Set material reference to 'custom' blue material
        back.materialReference = "blue";
        // Set size to match the screen resolution so it will fill the entire screen
        back.size = new Vector2(Screen.width, Screen.height);
        // Set the display depth all the way back so everything else will come on top
        back.depth = 1000;
        // Set fill image size to 50 x 50 pixels
        back.fillSize = new Vector2(50, 50);
        // Set scroll speed so we will scroll horizontally 20 px / second
        back.scrollSpeed = new Vector2(20, 0);

        // To create the animating star we first have to create the sprite sheet object that will
        // hold our texture/animation frames
        OTSpriteSheet sheet = OT.CreateObject(OTObjectType.SpriteSheet).GetComponent <OTSpriteSheet>();

        //  Give our sheet a name
        sheet.name = "mySheet";
        // Assign texture
        sheet.texture = greenStarsAnimation;
        // Specify how many columns and rows we have (frames)
        sheet.framesXY = new Vector2(25, 3);
        // Because we have some overhead space to the right and bottom of our texture we have to
        // specify the original texture size and the original frame size so that the right texture
        // scale and offsetting can be calculated.
        sheet.sheetSize = new Vector2(2048, 256);
        sheet.frameSize = new Vector2(80, 80);

        // Next thing is to create the animation that our animating sprite will use
        OTAnimation animation = OT.CreateObject(OTObjectType.Animation).GetComponent <OTAnimation>();
        // This animation will use only one frameset with all animating star frames.
        OTAnimationFrameset frameset = new OTAnimationFrameset();

        // Link up the sprite sheet to this animation's frameset
        frameset.container = sheet;
        // Frameset animation will start at frame index 0
        frameset.startFrame = 0;
        // Frameset animation will end at frame index 69
        frameset.endFrame = 69;
        // Assign this frameset to the animation.
        // HINT : by asigning more than one frameset it is possible to create an animation that will span
        // across mutiple framesets
        // HINT : Because it is possible (and very easy) to play a specific frameset of an animation
        // One could pack a lot of animations into one animation object.
        animation.framesets = new OTAnimationFrameset[] { frameset };
        // Set the duration of this animation
        // HINT : By using the OTAnimationSprite.speed setting one can speed up or slow down a
        // running animation without changing the OTAnimation.fps or .duration setting.
        animation.duration = .95f;
        // Lets give our animation a name
        animation.name = "star-animation";

        // To finally get the animatiing star on screen we will create our animation sprite object
        star = OT.CreateObject(OTObjectType.AnimatingSprite).GetComponent <OTAnimatingSprite>();
        // Link up the animation
        star.animation = animation;
        // Lets start at a random frame
        star.startAtRandomFrame = true;
        // Lets auto-start this animation
        star.playOnStart = true;
        // start invisible and make visible when containers are ready.
        star.visible         = false;
        star.name            = "star";
        star.spriteContainer = sheet;

        // INFO : This animation 'star' will be center (0,0) positioned and act as a prototype
        // to create more moveing and animating (additive) 'stars'.
    }
Beispiel #12
0
 void Awake()
 {
     anim = GetComponent<OTAnimation>();
     sprite = GetComponent<OTAnimatingSprite>();
     unit = GetComponent<Unit>();
     cc = GetComponent<CharacterController>();
     ac = GetComponent<AudioControl>();
 }
Beispiel #13
0
 void _DestroyAnimation(OTAnimation animation)
 {
     _RemoveAnimation(animation);
     if (animation.gameObject != null)
         Destroy(animation.gameObject);
 }
Beispiel #14
0
 void _RemoveAnimation(OTAnimation animation)
 {
     if (animationList.Contains(animation))
     {
         string lname = animation.name.ToLower();
         if (animations.ContainsKey(lname))
             animations.Remove(lname);
         if (animationList.Contains(animation))
             animationList.Remove(animation);
     }
 }
Beispiel #15
0
 void _RegisterAnimationLookup(OTAnimation animation, string oldName)
 {
     if (animationList.Contains(animation))
     {
         if (animations.ContainsKey(oldName.ToLower()) && animations[oldName.ToLower()] == animation)
             animations.Remove(oldName.ToLower());
         if (animations.ContainsKey(animation.name.ToLower()))
             animations.Remove(animation.name.ToLower());
         animations.Add(animation.name.ToLower(), animation);
     }
 }
Beispiel #16
0
    void _RegisterAnimation(OTAnimation animation)
    {
        if (!animationList.Contains(animation))
            animationList.Add(animation);
        if (!animations.ContainsKey(animation.name.ToLower()))
            animations.Add(animation.name.ToLower(), animation);
        else
        {
            if (animations[animation.name.ToLower()] != animation)
                Debug.LogError("More than one Animation with name '" + animation.name + "'");
        }
		
		foreach (Transform child in transform)
		{
			if (child.name.ToLower() == "animations")
			{
				animation.transform.parent = child.transform;
				break;
			}
		}
				
		
    }
Beispiel #17
0
	void _ResetAnimation(OTAnimation animation)
	{
		animation.Reset();		
	}
    void SetAnimationFrame(OTAnimation.Frame animationFrame)
    {
        if (spriteContainer != animationFrame.container || animationFrame.frameIndex != frameIndex)
        {
            if (passive)
            {
                spriteContainer = animationFrame.container;
                frameIndex = animationFrame.frameIndex;
            }
            else
            {
                _spriteContainer = animationFrame.container;
                _frameIndex = animationFrame.frameIndex;
            }

            if (onAnimationFrame != null)
                onAnimationFrame(this);
            if (!CallBack("onAnimationFrame", callBackParams))
                CallBack("OnAnimationFrame", callBackParams);

            isDirty = true;
        }
    }
Beispiel #19
0
 public static void RegisterAnimationLookup(OTAnimation animation, string oldName)
 {
     if (isValid)
         instance._RegisterAnimationLookup(animation, oldName);
 }
Beispiel #20
0
 // Use this for initialization
 protected void Awake()
 {
     anim = GetComponent<OTAnimation>();
     sprite = GetComponent<OTAnimatingSprite>();
     print (	sprite.animationFrameset);
 }
Beispiel #21
0
 /// <summary>
 /// Destroys an Orthello animation
 /// </summary>
 public static void DestroyAnimation(OTAnimation animation)
 {
     if (isValid)
         instance._DestroyAnimation(animation);
 }
 /// <summary>
 /// Plays a specific animation backward.
 /// </summary>
 /// <param name="animation">Animation to play.</param>
 public void PlayBackward(OTAnimation animation)
 {
     if (animation != null)
     {
         this.animation = animation;
         this.animationFrameset = "";
         PlayBackward();
     }
 }
Beispiel #23
0
 public static void RemoveAnimation(OTAnimation o)
 {
     if (isValid)
         instance._RemoveAnimation(o);
 }
 /// <summary>
 /// Plays a specific animation backward starting at the start frame.
 /// </summary>
 /// <param name="animation">Animation to play.</param>
 /// <param name="startFrame">Animation frame number (from the back) where to start.</param>
 public void PlayBackward(OTAnimation animation, int startFrame)
 {
     if (animation != null)
     {
         this.animation = animation;
         this.animationFrameset = "";
         PlayBackward(startFrame);
     }
 }
 // Use this for initialization
 protected void Awake()
 {
     anim = GetComponent<OTAnimation>();
     sprite = GetComponent<OTAnimatingSprite>();
 }
 void Awake()
 {
     GlobalOptions options = GlobalOptions.Instance;
     playerTeams = options.GetPlayerTeams();
     playerCharacters = options.GetPlayerCharacters();
     // This is hardcoded to 4 players and 4 teams.
     for (int i = 0; i < 4; i++) {
         GameObject player = playerPrefabs[i];
         playerStarts[i] = GameObject.Find("Player" + (i + 1).ToString() + " Start").GetComponent<Transform>();
         teamScoreStarts[i] = GameObject.Find("TeamScore" + (i + 1).ToString() + " Start").GetComponent<Transform>();
     }
     ballStart = GameObject.Find("Ball Start").GetComponent<Transform>();
     ballAnimation = GameObject.Find("Ball Animation").GetComponent<OTAnimation>();
 }
Beispiel #27
0
    private void getDefaultAnim()
    {
        //Obtengo la animacion de tapar la carta

        GameObject[] anim = GameObject.FindGameObjectsWithTag("cardToBack");
        this.cardToBack = (OTAnimation)anim[0].GetComponent(typeof(OTAnimation));
    }