상속: MonoBehaviour
예제 #1
0
 private Point Animation(int waittime)
 {
     return(CharacterAnimation.ReturnKai(new int[7]
     {
         1,
         8,
         16,
         4,
         4,
         52,
         4
     }, new int[7] {
         -1, 1, 8, 9, 10, 10, -1
     }, 0, waittime));
 }
예제 #2
0
 public Point MoveAnimation(int waittime)
 {
     return(CharacterAnimation.ReturnKai(new int[7]
     {
         6,
         2,
         2,
         2,
         2,
         2,
         100
     }, new int[7] {
         0, 1, 2, 3, 4, 5, 6
     }, 6, waittime));
 }
예제 #3
0
    public void die()
    {
        if (isDead)
        {
            return;
        }

        ClearSay();
        StopTalking();

        dropObject();
        if (deathParticles)
        {
            GameObject ps   = Instantiate(deathParticles, gameObject.transform.position, Quaternion.identity);
            var        main = ps.GetComponent <ParticleSystem>().main;
            main.startColor = gameObject.GetComponent <SpriteRenderer>().color;
        }

        if (respawn)
        {
            if (respawnOverride)
            {
                respawnPosition = respawnOverride.position;
            }

            respawnTimer = respawnTime;
        }

        isDead = true;

        if (dieSound)
        {
            global.audio.Play(dieSound);
        }

        layerBeforeDeath          = gameObject.layer;
        gameObject.layer          = LayerMask.NameToLayer("DisableAllCollision");
        kinematicStateBeforeDeath = m_Rigidbody2D.isKinematic;
        m_Rigidbody2D.isKinematic = true;
        m_Rigidbody2D.Sleep();
        m_Rigidbody2D.velocity = new Vector3(0f, 0f, 0f);

        if (charAnim == null)
        {
            charAnim = gameObject.GetComponent <CharacterAnimation>();
        }
        charAnim.characterDied();
    }
예제 #4
0
        private void CreateCharacterAnimation(Player player, Point position)
        {
            var definition = new CharacterAnimationDefinition()
            {
                Character = player.CharacterActive,
                FrameRate = 10,
                FrameSize = new Point(24, 32),
                Scale     = new Point(2, 2),
                Loop      = true,
                NbFrames  = new Point(3, 1)
            };

            var animation = new CharacterAnimation(definition, position);

            _spritesToAdd.Add(player, animation);
        }
예제 #5
0
 private Point swordSet(int waittime)
 {
     return(CharacterAnimation.ReturnKai(new int[8]
     {
         4,
         4,
         4,
         2,
         2,
         2,
         4,
         4
     }, new int[8] {
         0, 1, 2, 3, 4, 5, 6, 7
     }, 0, waittime));
 }
예제 #6
0
    }                                                            //Should be inventoryItemData<WeaponData> or something

    public void Initialize(CharacterAnimation animation, CharacterBody body, IInventory inventory)
    {
        this.animation = animation;
        this.body      = body;

        foreach (var item in inventory.Items)
        {
            var clothing = item.Key as IEquippable;
            if (clothing == null)
            {
                continue;
            }

            Equip(clothing, false);
        }
    }
예제 #7
0
 private Point AnimeSwors(int waittime)
 {
     return(CharacterAnimation.ReturnKai(new int[8]
     {
         10,
         8,
         2,
         2,
         2,
         2,
         5,
         10
     }, new int[8] {
         2, 2, 3, 4, 5, 6, 7, 8
     }, 0, waittime));
 }
    private void Awake()
    {
        animationScript = GetComponent <CharacterAnimation>();
        audioSource     = GetComponent <AudioSource>();
        shakeCamera     = GameObject.FindWithTag(Tags.MAIN_CAMERA_TAG).GetComponent <ShakeCamera>();

        if (gameObject.CompareTag(Tags.ENEMY_TAG))
        {
            enemyMovement = GetComponentInParent <EnemyMovement>();
        }

        if (gameObject.CompareTag(Tags.PLAYER_TAG))
        {
            playerMovement = GetComponentInParent <PlayerMovement>();
        }
    }
예제 #9
0
 private Point AnimeImpact(int waittime)
 {
     return(CharacterAnimation.ReturnKai(new int[8]
     {
         1,
         1,
         1,
         2,
         1,
         1,
         1,
         100
     }, new int[8] {
         0, 10, 11, 12, 13, 14, 15, 16
     }, 0, waittime));
 }
예제 #10
0
        protected Point Animation(int waittime)
        {
            int[] interval = new int[6] {
                4, 1, 1, 8, 1, 60
            };
            int[] xpoint = new int[6] {
                0, 8, 12, 13, 16, 17
            };
            for (int index = 0; index < interval.Length; ++index)
            {
                interval[index] *= 5;
            }
            int y = 0;

            return(CharacterAnimation.ReturnKai(interval, xpoint, y, waittime));
        }
예제 #11
0
 private Point AnimeMove(int waittime)
 {
     return(CharacterAnimation.ReturnKai(new int[8]
     {
         1,
         1,
         1,
         1,
         1,
         1,
         1,
         100
     }, new int[8] {
         8, 15, 16, 17, 17, 16, 15, 8
     }, 0, waittime));
 }
예제 #12
0
 private Point AnimeFlearShot(int waittime)
 {
     return(CharacterAnimation.ReturnKai(new int[8]
     {
         1,
         1,
         4,
         1,
         1,
         1,
         1,
         100
     }, new int[8] {
         0, 1, 2, 3, 4, 5, 6, 7
     }, 1, waittime));
 }
예제 #13
0
    public override AnimationTransition OnStateUpdate(CharacterAnimation animation, bool currentStateEnabled)
    {
        var result = base.OnStateUpdate(animation, true);

        //if (hasSpeedParameter)
        //{
        //	var speed = animation.GetParameter<float>(speedParameter);
        //	if(speed != previousSpeed && animation.CurrentState != null)
        //	{
        //              animation.CurrentState.speed = speed;
        //		previousSpeed = speed;
        //	}
        //}

        //// Check each transition within this state to see if it should change
        //foreach (var stateTransition in stateTransitions)
        //{
        //	if (!stateTransition.CheckConditions(animation, animation.CurrentState))
        //	{
        //		continue;
        //	}

        //	// if the current state was true, stop checking as it should keep playing. (Otherwise it goes back and forth between states)
        //	if (activeState != stateTransition)
        //	{
        //		if (activeState != null)
        //		{
        //			animation.animation.Stop(stateTransition.AnimationName);
        //		}

        //		activeState = stateTransition;
        //              animation.CurrentState = animation.animation[stateTransition.AnimationName];
        //		animation.animation.Play(stateTransition.AnimationName);
        //	}

        //	return result;
        //}

        //// if none of the sub-states were triggered, play the base state
        //if(activeState != baseState)
        //{
        //	activeState = baseState;
        //	animation.animation.Play(baseState.AnimationName);
        //}

        return(result);
    }
예제 #14
0
 private Point AnimeCross(int waittime)
 {
     return(CharacterAnimation.ReturnKai(new int[9]
     {
         1,
         1,
         1,
         1,
         2,
         1,
         1,
         1,
         100
     }, new int[9] {
         0, 2, 3, 14, 15, 16, 17, 18, 19
     }, 0, waittime));
 }
예제 #15
0
 private Point AnimeDarkWave1(int waittime)
 {
     return(CharacterAnimation.ReturnKai(new int[9]
     {
         1,
         1,
         1,
         1,
         1,
         2,
         1,
         1,
         1
     }, new int[9] {
         0, 3, 4, 5, 6, 7, 6, 5, 4
     }, 0, waittime));
 }
예제 #16
0
 private Point AnimeIllProminence2(int waittime)
 {
     return(CharacterAnimation.ReturnKai(new int[9]
     {
         1,
         1,
         1,
         1,
         1,
         1,
         1,
         1,
         100
     }, new int[9] {
         1, 2, 3, 4, 5, 6, 1, 5, 6
     }, 1, waittime));
 }
예제 #17
0
 private Point AnimeAttack(int waitflame)
 {
     return(CharacterAnimation.ReturnKai(new int[9]
     {
         0,
         2,
         1,
         1,
         8,
         2,
         8,
         1,
         1
     }, new int[9] {
         0, 1, 2, 3, 4, 5, 4, 1, 0
     }, 1, waitflame));
 }
예제 #18
0
    public void CheckAnimation()
    {
        if (LastAnim != action)
        {
            ImageIndex = 0;
            LastAnim   = action;
            MaxRow     = CharacterAnimations.GetAnimationLenght(action);
        }

        SpriteColumn = ((int)action * 4) + (int)direction;
        if (SpriteColumn >= CharacterAnimations.MaxColumn - 1)
        {
            SpriteColumn = CharacterAnimations.MaxColumn - 1;
        }

        transform.localPosition = new Vector3(-ImageIndex * 64 - 32, SpriteColumn * 64 + 32, 0);
    }
예제 #19
0
 protected Point AnimeMove(int waitflame)
 {
     return(CharacterAnimation.Return(new int[9]
     {
         0,
         1,
         2,
         3,
         4,
         5,
         7,
         8,
         9
     }, new int[8] {
         2, 1, 0, 1, 2, 2, 1, 0
     }, 1, waitflame));
 }
예제 #20
0
    void Start()
    {
        _backgroundManager = GameObject.FindGameObjectWithTag("Canvas").GetComponent <BackgroundManager>();
        _spriteManager     = GetComponent <SpriteManager>();
        _clariz            = GameObject.FindGameObjectWithTag("Clariz");
        _gerald            = GameObject.FindGameObjectWithTag("Gerald");

        _clarizRaycaster  = _clariz.GetComponent <ClarizRaycaster>();
        _clarizHealth     = _clariz.GetComponent <ClarizHealth>();
        _clarizAnimation  = _clariz.GetComponent <CharacterAnimation>();
        _characterControl = _clariz.GetComponent <CharacterControl>();
        _geraldAnimation  = _gerald.GetComponent <CharacterAnimation>();
        _geraldMovement   = _gerald.GetComponent <GeraldMovement>();
        _spawnManager     = GameObject.FindGameObjectWithTag("SpawnPoint").GetComponent <SpawnManager>();
        _tryAgainButton   = GameObject.FindGameObjectWithTag("TryAgainButton").GetComponent <TryAgainButton>();
        _loadingGiftText  = GameObject.FindGameObjectWithTag("LoadingGiftText");
    }
예제 #21
0
    public void Invoke(CharacterAnimation animation)
    {
        switch (type)
        {
        case TransitionType.Bool:
            animation.SetParameter(name, boolValue);
            break;

        case TransitionType.Int:
            animation.SetParameter(name, intValue);
            break;

        case TransitionType.Float:
            animation.SetParameter(name, floatValue);
            break;
        }
    }
예제 #22
0
 // Use this for initialization
 void Start()
 {
     actions = new List <List <string> >();
     actions.Add(new List <string>());
     actions[0].Add("main:");
     indices        = new List <int>();
     direction      = "right";
     savedDirection = "right";
     character      = GetComponent <Character>();
     charAnim       = GetComponent <CharacterAnimation>();
     nest           = new List <int>();
     target         = null;
     broken         = false;
     nest.Add(0);
     indices.Add(1);
     weaponLoaded = true;
 }
예제 #23
0
 private Point AnimeMiss(int waittime)
 {
     return(CharacterAnimation.ReturnKai(new int[9]
     {
         1,
         4,
         1,
         1,
         1,
         1,
         1,
         1,
         100
     }, new int[9] {
         0, 17, 18, 19, 20, 19, 20, 21, 22
     }, 0, waittime));
 }
예제 #24
0
 private Point AnimeNeutral(int waitflame)
 {
     return(CharacterAnimation.ReturnKai(new int[19]
     {
         1,
         1,
         1,
         1,
         1,
         1,
         1,
         1,
         1,
         1,
         1,
         1,
         1,
         1,
         1,
         1,
         1,
         1,
         100
     }, new int[18]
     {
         0,
         1,
         2,
         0,
         1,
         2,
         0,
         1,
         2,
         0,
         1,
         2,
         0,
         1,
         2,
         0,
         1,
         2
     }, 0, this.waittime));
 }
예제 #25
0
 private Point Animation(int waittime)
 {
     return(CharacterAnimation.ReturnKai(new int[18]
     {
         1,
         2,
         2,
         4,
         12,
         4,
         4,
         4,
         4,
         4,
         60,
         4,
         4,
         4,
         4,
         2,
         2,
         4
     }, new int[19]
     {
         -1,
         3,
         2,
         1,
         0,
         4,
         5,
         6,
         7,
         8,
         9,
         5,
         6,
         4,
         0,
         1,
         2,
         3,
         -1
     }, 0, waittime));
 }
예제 #26
0
 private Point Animation(int waittime)
 {
     return(CharacterAnimation.ReturnKai(new int[10]
     {
         1,
         1,
         1,
         2,
         1,
         1,
         1,
         1,
         1,
         100
     }, new int[10] {
         4, 3, 2, 0, 0, 5, 6, 7, 8, 9
     }, 0, waittime));
 }
예제 #27
0
 protected Point Animation(int waittime)
 {
     return(CharacterAnimation.ReturnKai(new int[10]
     {
         1,
         4,
         4,
         4,
         4,
         12,
         4,
         4,
         4,
         4
     }, new int[10] {
         -1, 9, 8, 7, 3, 0, 3, 7, 13, 14
     }, 0, waittime));
 }
예제 #28
0
 private Point AnimeMissile(int waittime)
 {
     return(CharacterAnimation.ReturnKai(new int[10]
     {
         4,
         4,
         8,
         18,
         4,
         3,
         4,
         4,
         4,
         60
     }, new int[10] {
         0, 20, 21, 22, 23, 24, 25, 26, 27, 28
     }, 0, waittime));
 }
예제 #29
0
    void Start()
    {
        characterAnimation = GetComponent <CharacterAnimation>();
        characterAiming    = GetComponent <CharacterAiming>();

        RaycastWeapon existingWeapon = GetComponentInChildren <RaycastWeapon>();

        if (existingWeapon)
        {
            Equip(existingWeapon);
            AlignCamerasToWeapon(existingWeapon);
            hasWeapon = true;
        }
        else
        {
            hasWeapon = false;
        }
    }
예제 #30
0
 private Point AnimeSpark(int waittime)
 {
     return(CharacterAnimation.ReturnKai(new int[10]
     {
         4,
         4,
         4,
         4,
         4,
         4,
         60,
         4,
         4,
         4
     }, new int[11] {
         0, 4, 5, 6, 7, 8, 11, 5, 4, 0, 0
     }, 0, waittime));
 }
예제 #31
0
    void Start()
    {
        //Get reference to level info from the game manager
        levelInfo = GameManager.instance.levelInfo;

        characterAction = GetComponent<CharacterAction>();
        characterAnimation = GetComponent<CharacterAnimation>();

        //Get spawn node if player, enemies are set when spawned
        if(isPlayer)
            spawnNode = levelInfo.GetSpawnTile(TileNode.Type.PlayerSpawn);

        //Start character at spawn node
        transform.position = spawnNode.worldPosition;
        //Set array position to spawn node
        MoveToNode(spawnNode.gridPosition);

        //set target position to current
        newPos = transform.position;
    }
예제 #32
0
		void SetAnimation (CharacterAnimation index, string animationName, string sceneName)
		{
			// Load the DAE using SCNSceneSource in order to be able to retrieve the animation by its identifier
			var path = NSBundle.MainBundle.PathForResource ("Scenes/hero/" + sceneName, "dae");
			var sceneURL = NSUrl.FromFilename (path);
			var sceneSource = SCNSceneSource.FromUrl (sceneURL, (NSDictionary)null);

			var animation = (CAAnimation)sceneSource.GetEntryWithIdentifier (animationName, new Class ("CAAnimation"));
			Animations [(int)index] = animation;

			// Blend animations for smoother transitions
			animation.FadeInDuration = 0.3f;
			animation.FadeOutDuration = 0.3f;

			if (index == CharacterAnimation.Die) {
				// We want the "death" animation to remain at its final state at the end of the animation
				animation.RemovedOnCompletion = false;
				animation.FillMode = CAFillMode.Both;

				// Create animation events and set them to the animation
				var swipeSoundEventHandler = new SCNAnimationEventHandler ((CAAnimation handlerAnimation, NSObject animatedObject, bool playingBackward) => {
					InvokeOnMainThread (delegate {
						var soundUrl = NSUrl.FromFilename (NSBundle.MainBundle.PathForResource ("Sounds/swipe", "wav"));
						new NSSound (soundUrl, false).Play ();
					});
				});

				var deathSoundEventBlock = new SCNAnimationEventHandler ((CAAnimation handlerAnimation, NSObject animatedObject, bool playingBackward) => {
					InvokeOnMainThread (delegate {
						var soundUrl = NSUrl.FromFilename (NSBundle.MainBundle.PathForResource ("Sounds/death", "wav"));
						new NSSound (soundUrl, false).Play ();
					});
				});

				animation.AnimationEvents = new SCNAnimationEvent[] {
					SCNAnimationEvent.Create (0.0f, swipeSoundEventHandler),
					SCNAnimationEvent.Create (0.3f, deathSoundEventBlock)
				};
			}

			if (index == CharacterAnimation.Attack) {
				// Create an animation event and set it to the animation
				var swordSoundEventHandler = new SCNAnimationEventHandler ((CAAnimation handlerAnimation, NSObject animatedObject, bool playingBackward) => {
					InvokeOnMainThread (delegate {
						var soundUrl = NSUrl.FromFilename (NSBundle.MainBundle.PathForResource ("Sounds/sword", "wav"));
						var attackSound = new NSSound (soundUrl, false);
						attackSound.Play ();
					});
				});

				animation.AnimationEvents = new SCNAnimationEvent[] { SCNAnimationEvent.Create (0.4f, swordSoundEventHandler) };
			}

			if (index == CharacterAnimation.Walk) {
				// Repeat the walk animation 3 times
				animation.RepeatCount = 3;

				// Create an animation event and set it to the animation
				var stepSoundEventHandler = new SCNAnimationEventHandler ((CAAnimation handlerAnimation, NSObject animatedObject, bool playingBackward) => {
					InvokeOnMainThread (delegate {
						var soundUrl = NSUrl.FromFilename (NSBundle.MainBundle.PathForResource ("Sounds/walk", "wav"));
						new NSSound (soundUrl, false).Play ();
					});
				});

				animation.AnimationEvents = new SCNAnimationEvent[] {
					SCNAnimationEvent.Create (0.2f, stepSoundEventHandler),
					SCNAnimationEvent.Create (0.7f, stepSoundEventHandler)
				};
			}
		}
 protected void Awake()
 {
     m_movementController = gameObject.AddComponent<MovementController>();
     m_characterAudio = GetComponentInChildren<CharacterAudio>();
     m_characterAnimation = GetComponentInChildren<CharacterAnimation>();
 }
예제 #34
0
		private void SetAnimation (CharacterAnimation index, string animationName, string sceneName)
		{
			// Load the DAE using SCNSceneSource in order to be able to retrieve the animation by its identifier
			var sceneURL = NSUrl.FromFilename (NSBundle.MainBundle.PathForResource ("Scenes.scnassets/boss/" + sceneName, "dae"));
			var sceneSource = SCNSceneSource.FromUrl (sceneURL, (NSDictionary)null);

			var bossAnimation = (CAAnimation)sceneSource.GetEntryWithIdentifier (animationName, new Class ("CAAnimation"));
			Animations [(int)index] = bossAnimation;

			// Blend animations for smoother transitions
			bossAnimation.FadeInDuration = 0.3f;
			bossAnimation.FadeOutDuration = 0.3f;

			if (index == CharacterAnimation.Attack) {
				// Create an animation event and set it to the animation
				var attackSoundEvent = new SCNAnimationEventHandler ((CAAnimation animation, NSObject animatedObject, bool playingBackward) => {
					InvokeOnMainThread (delegate {
						var soundUrl = NSUrl.FromFilename (NSBundle.MainBundle.PathForResource ("Sounds/attack4", "wav"));
						new NSSound (soundUrl, false).Play ();
					});
				});
				bossAnimation.AnimationEvents = new SCNAnimationEvent[] { SCNAnimationEvent.Create (0.4f, attackSoundEvent) };
			}
		}
예제 #35
0
 public EnemySkill(Character subject, CharacterAnimation right, CharacterAnimation left, int cooldown, int damage, Constants.DamageType damageType)
     : base(subject, right, left, cooldown, damage, damageType)
 {
     Conditions = new List<Condition>();
 }
예제 #36
0
파일: Character.cs 프로젝트: BobbyBao/Aegis
    protected virtual void Awake()
    {
        animator = GetComponent<Animator>();
        navAgent = GetComponent<NavMeshAgent>();

        state = gameObject.AddComponent<CharacterAnimation>();
        movement = gameObject.AddComponent<CharacterMovement>();

        navPath = new NavMeshPath();
    }
예제 #37
0
 void RenderSelectedCharacterDetails()
 {
     selectedCharacter.CharacterName = GUILayout.TextField(selectedCharacter.CharacterName);
     AnimationID[] idsArray = Enum.GetValues(typeof(AnimationID)).Cast<AnimationID>().ToArray();
     selectedAnimationIdIndex = EditorGUILayout.Popup(selectedAnimationIdIndex, idsArray.Select (id => id.ToString()).ToArray());
     animation = selectedCharacter.GetAnimation(idsArray[selectedAnimationIdIndex]);
 }
예제 #38
0
		void SetupAnimation (string path, CharacterAnimation animationType)
		{
			LoadAndCacheAnimation (path, KeyForAnimationType (animationType));
			CAAnimation animation = CachedAnimationForKey (KeyForAnimationType (animationType));

			if (animation != null)
				animation.RepeatCount = float.MaxValue;
		}
예제 #39
0
파일: CHR.cs 프로젝트: osROSE/UnityRose
        public void Load(string filePath)
        {
            var fh = new FileHandler(filePath, FileHandler.FileOpenMode.Reading, Encoding.UTF8);

            short skeletonFileCount = fh.Read<short>();

            for (int i = 0; i < skeletonFileCount; i++)
            {
                string skeletonFile = fh.Read<ZString>();
                SkeletonFiles.Add(skeletonFile);
            }

            short motionFileCount = fh.Read<short>();

            for (int i = 0; i < motionFileCount; i++)
            {
                string motionFile = fh.Read<ZString>();

                MotionFiles.Add(motionFile);
            }

            short effectFileCount = fh.Read<short>();

            for (int i = 0; i < effectFileCount; i++)
            {
                string effectFile = fh.Read<ZString>();

                EffectFiles.Add(effectFile);
            }

            short characterCount = fh.Read<short>();

            for (int i = 0; i < characterCount; i++)
            {
                Character character = new Character();
                character.IsEnabled = fh.Read<char>() != 0;

                if (character.IsEnabled)
                {
                    character.ID = fh.Read<short>();
                    character.Name = fh.Read<ZString>();

                    short objectCount = fh.Read<short>();

                    for (int j = 0; j < objectCount; j++)
                    {
                        CharacterObject @object = new CharacterObject();
                        @object.Object = fh.Read<short>();

                        character.Objects.Add(@object);
                    }

                    short animationCount = fh.Read<short>();

                    for (int j = 0; j < animationCount; j++)
                    {
                        CharacterAnimation animation = new CharacterAnimation();
                        animation.Type = (AnimationType)fh.Read<short>();
                        animation.Animation = fh.Read<short>();

                        character.Animations.Add(animation);
                    }

                    short effectCount = fh.Read<short>();

                    for (int j = 0; j < effectCount; j++)
                    {
                        CharacterEffect effect = new CharacterEffect();
                        effect.Bone = fh.Read<short>();
                        effect.Effect = fh.Read<short>();

                        character.Effects.Add(effect);
                    }
                }

                Characters.Add(character);
            }
        }
예제 #40
0
		NSString KeyForAnimationType (CharacterAnimation animType)
		{
			var resultString = string.Empty;
			switch (animType) {
			case CharacterAnimation.Bored:
				resultString = "bored-1";
				break;
			case CharacterAnimation.Die:
				resultString = "die-1";
				break;
			case CharacterAnimation.GetHit:
				resultString = "hit-1";
				break;
			case CharacterAnimation.Idle:
				resultString = "idle-1";
				break;
			case CharacterAnimation.Jump:
				resultString = "jump_start-1";
				break;
			case CharacterAnimation.JumpFalling:
				resultString = "jump_falling-1";
				break;
			case CharacterAnimation.JumpLand:
				resultString = "jump_land-1";
				break;
			case CharacterAnimation.Run:
				resultString = "run-1";
				break;
			case CharacterAnimation.RunStart:
				resultString = "run_start-1";
				break;
			case CharacterAnimation.RunStop:
				resultString = "run_stop-1";
				break;
			}

			return new NSString (resultString);
		}