Example #1
0
    private void OnEnable()
    {
        audio               = GetComponent <AudioSource>();
        fog                 = GetComponent <FogOfWarEntity>();
        mesh                = GetComponent <SkinnedMeshRenderer>();
        myChampionData      = GetComponent <ChampionData>();
        myChampionAnimation = GetComponent <ChampionAnimation>();
        ChampHP             = transform.GetComponent <ChampionHP>();
        icon                = transform.parent.GetComponentInChildren <ChampionIcon>().gameObject;
        rigidbody           = GetComponent <Rigidbody>();
        myPhotonView        = GetComponent <PhotonView>();
        if (myPhotonView.owner.GetTeam().ToString().Equals("blue"))
        {
            Team = "Blue";
        }
        if (photonView.owner.Equals(PhotonNetwork.player) && SceneManager.GetActiveScene().name.Equals("Selection"))
        {
            ChampionSound.instance.SelectionVoice(PlayerData.Instance.championName);
        }

        if (!myPhotonView.isMine) // 사운드
        {
            audio.volume       = 0.5f;
            audio.loop         = false;
            audio.spatialBlend = 1f;
            audio.rolloffMode  = AudioRolloffMode.Linear;
            audio.maxDistance  = 20f;
        }
    }
Example #2
0
    private void Awake()
    {
        if (myChamp == null)
        {
            myChamp = transform.parent.gameObject;
        }

        myChampionData      = myChamp.GetComponent <ChampionData>();
        TheAIPath           = myChamp.GetComponent <AIPath>();
        TheAIDest           = myChamp.GetComponent <AIDestinationSetter>();
        ThePlayerMouse      = myChamp.GetComponent <PlayerMouse>();
        aStarTargetObj      = ThePlayerMouse.myTarget;
        enemiesList         = new List <GameObject>();
        myChampBehav        = myChamp.GetComponent <ChampionBehavior>();
        myChampionAnimation = myChamp.GetComponent <ChampionAnimation>();
        champName           = PlayerData.Instance.championName;

        if (myChamp.transform.parent.name.Contains("Ashe"))
        {
            asheSkill = myChamp.GetComponent <AsheSkill>();

            if (asheSkill != null)
            {
                isAshe = true;
            }
        }
    }
    /// <summary>
    /// When champion created Champion and teamID passed
    /// </summary>
    /// <param name="_champion"></param>
    /// <param name="_teamID"></param>
    public void Init(Champion _champion, int _teamID)
    {
        champion = _champion;
        teamID   = _teamID;

        //store scripts
        map                   = GameObject.Find("Scripts").GetComponent <Map>();
        aIopponent            = GameObject.Find("Scripts").GetComponent <AIopponent>();
        gamePlayController    = GameObject.Find("Scripts").GetComponent <GamePlayController>();
        worldCanvasController = GameObject.Find("Scripts").GetComponent <WorldCanvasController>();
        navMeshAgent          = this.GetComponent <NavMeshAgent>();
        championAnimation     = this.GetComponent <ChampionAnimation>();

        //disable agent
        navMeshAgent.enabled = false;

        //set stats
        maxHealth     = champion.health;
        currentHealth = champion.health;
        currentDamage = champion.damage;

        worldCanvasController.AddHealthBar(this.gameObject);

        effects = new List <Effect>();
    }
Example #4
0
		public ChampionAnimation GetAnim(bool dead, bool onGround,
		                                 bool castingSpell1,
		                                 bool castingSpell2,
		                                 bool castingSpell3,
		                                 bool castingSpell4,
		                                 int movement,
		                                 bool isIdle,
		                                 ChampionAnimation oldAnim)
		{
			// Dead champion
			if (dead) return ChampionAnimation.die;

			// Casting spell
			if (castingSpell1) return ChampionAnimation.spell1;
			if (castingSpell2) return ChampionAnimation.spell2;
			if (castingSpell3) return ChampionAnimation.spell3;
			if (castingSpell4) return ChampionAnimation.spell4;

			// Falling/jumping
			if (!onGround) return ChampionAnimation.jump;

			// Moving left/right
			if (movement != 0) return ChampionAnimation.run;

			// No recent actions
			if (isIdle) return ChampionAnimation.idle;

			// No updates since, keep our previous animation
			return oldAnim;
		}
Example #5
0
 public StateUpdateData(ulong id, Vec2 pos, Vec2 vel, ChampionAnimation anim, bool facingLeft)
     : this()
 {
     ID         = id;
     Position   = pos;
     Velocity   = vel;
     Animation  = anim;
     FacingLeft = facingLeft;
 }
		public DrawableChampionSprite(ChampionAnimation startAnim, ChampionTypes type, ChampionsInfo championsInfo)
			: base (championsInfo.GetInfo(type).AssetName,
			        championsInfo.GetInfo(type).FrameWidth,
			        championsInfo.GetInfo(type).FrameHeight,
			        championsInfo.GetInfo(type).GetAnimation(startAnim).Line,
			        championsInfo.GetInfo(type).GetAnimation(startAnim).FrameRate,
			        championsInfo.GetInfo(type).GetAnimation(startAnim).FrameCount)
        {
			Information = championsInfo.GetInfo(type);
			CurrentAnimation = startAnim;
        }
 public DrawableChampionSprite(ChampionAnimation startAnim, ChampionTypes type, ChampionsInfo championsInfo)
     : base(championsInfo.GetInfo(type).AssetName,
            championsInfo.GetInfo(type).FrameWidth,
            championsInfo.GetInfo(type).FrameHeight,
            championsInfo.GetInfo(type).GetAnimation(startAnim).Line,
            championsInfo.GetInfo(type).GetAnimation(startAnim).FrameRate,
            championsInfo.GetInfo(type).GetAnimation(startAnim).FrameCount)
 {
     Information      = championsInfo.GetInfo(type);
     CurrentAnimation = startAnim;
 }
Example #8
0
 /// <summary>
 /// 최초 설정 값을 잡는 함수
 /// </summary>
 public virtual void InitInstance()
 {
     skillObj             = new Dictionary <string, List <GameObject> >();
     TheSkillClass        = SkillClass.Instance;
     skillParticleManager = new GameObject("SkillParticleManager");
     skillParticleManager.transform.parent = this.transform.parent;
     TheChampionData      = GetComponent <ChampionData>();
     TheSplatManager      = GetComponentInChildren <SplatManager>();
     TheChampionBehaviour = GetComponent <ChampionBehavior>();
     championAnimation    = GetComponent <ChampionAnimation>();
 }
Example #9
0
        public ChampionAnimation GetAnim(bool dead, bool onGround,
                                         bool castingSpell1,
                                         bool castingSpell2,
                                         bool castingSpell3,
                                         bool castingSpell4,
                                         int movement,
                                         bool isIdle,
                                         ChampionAnimation oldAnim)
        {
            // Dead champion
            if (dead)
            {
                return(ChampionAnimation.die);
            }

            // Casting spell
            if (castingSpell1)
            {
                return(ChampionAnimation.spell1);
            }
            if (castingSpell2)
            {
                return(ChampionAnimation.spell2);
            }
            if (castingSpell3)
            {
                return(ChampionAnimation.spell3);
            }
            if (castingSpell4)
            {
                return(ChampionAnimation.spell4);
            }

            // Falling/jumping
            if (!onGround)
            {
                return(ChampionAnimation.jump);
            }

            // Moving left/right
            if (movement != 0)
            {
                return(ChampionAnimation.run);
            }

            // No recent actions
            if (isIdle)
            {
                return(ChampionAnimation.idle);
            }

            // No updates since, keep our previous animation
            return(oldAnim);
        }
Example #10
0
        /// <summary>
        /// Gets the animation with the given name.
        /// </summary>
        /// <returns>The animation.</returns>
        /// <param name="name">Name.</param>
        public AnimationInfo GetAnimation(ChampionAnimation name)
        {
            foreach (AnimationInfo anim in Animations)
            {
                if (anim.Name == name)
                {
                    return(anim);
                }
            }

            Debug.Fail("No animation with the name " + name + " for the champion " + Name + ".");
            return(null);
        }
		/// <summary>
		/// Plays the animation.
		/// If the animation doesn't exist, this call is ignored;
		/// </summary>
		/// <param name="name">Name.</param>
		public void PlayAnimation(ChampionAnimation name)
		{
			AnimationInfo anim = Information.GetAnimation(name);

			Debug.Assert(anim != null, "The animation does not exist.");

			if (anim!=null) {
				CurrentAnimation = name;
				Line = anim.Line;
				FrameCount = anim.FrameCount;
				FrameRate = anim.FrameRate;
				CurrentFrame = 0;
				RepetitionCount = anim.Repeat ? INFINITE : 1;
			}
		}
        /// <summary>
        /// Plays the animation.
        /// If the animation doesn't exist, this call is ignored;
        /// </summary>
        /// <param name="name">Name.</param>
        public void PlayAnimation(ChampionAnimation name)
        {
            AnimationInfo anim = Information.GetAnimation(name);

            Debug.Assert(anim != null, "The animation does not exist.");

            if (anim != null)
            {
                CurrentAnimation = name;
                Line             = anim.Line;
                FrameCount       = anim.FrameCount;
                FrameRate        = anim.FrameRate;
                CurrentFrame     = 0;
                RepetitionCount  = anim.Repeat ? INFINITE : 1;
            }
        }
Example #13
0
		public StateUpdateData(ulong id, Vec2 pos, Vec2 vel, ChampionAnimation anim, bool facingLeft)
			: this()
		{
			ID = id;
			Position = pos;
			Velocity = vel;
			Animation = anim;
			FacingLeft = facingLeft;
		}
Example #14
0
		/// <summary>
		/// Gets the animation with the given name.
		/// </summary>
		/// <returns>The animation.</returns>
		/// <param name="name">Name.</param>
		public AnimationInfo GetAnimation(ChampionAnimation name)
		{
			foreach (AnimationInfo anim in Animations)
				if (anim.Name == name)
					return anim;

			Debug.Fail("No animation with the name " + name + " for the champion " + Name + ".");
			return null;
		}
Example #15
0
        public StateUpdateEventArgs(NetBuffer msg) : base(msg)
        {
            EntitiesUpdatedState = new List <StateUpdateData>();
            RemarkableEvents     = new List <RemarkableEventData>();

            LastAcknowledgedActionID = msg.ReadUInt64();
            Time = msg.ReadDouble();
            Vec2 velocity  = new Vec2(msg.ReadFloat(), msg.ReadFloat());
            byte nbClients = msg.ReadByte();

            for (byte i = 0; i < nbClients; ++i)
            {
                ulong             id         = msg.ReadUInt64();
                Vec2              pos        = new Vec2(msg.ReadFloat(), msg.ReadFloat());
                ChampionAnimation anim       = (ChampionAnimation)msg.ReadByte();
                bool              facingLeft = msg.ReadBoolean();

                EntitiesUpdatedState.Add(new StateUpdateData(id, pos, velocity, anim, facingLeft));
            }
            while (msg.Position != msg.LengthBits)
            {
                ServerCommand       cmd  = (ServerCommand)msg.ReadByte();
                RemarkableEventData data = null;
                switch (cmd)
                {
                case ServerCommand.SpellCast:
                    data = new SpellCastEventData(
                        msg.ReadUInt64(),
                        msg.ReadUInt64(),
                        (SpellTypes)msg.ReadByte(),
                        msg.ReadFloat(),
                        new Vec2(msg.ReadFloat(), msg.ReadFloat()),
                        new Vec2(msg.ReadFloat(), msg.ReadFloat()),
                        TimeSpan.FromSeconds(msg.ReadFloat()),
                        msg.ReadFloat(),
                        msg.ReadFloat());
                    break;

                case ServerCommand.SpellDisappear:
                    data = new SpellDisappearEventData(msg.ReadUInt64());
                    break;

                case ServerCommand.StatsChanged:
                    data = new StatsChangedEventData(msg.ReadUInt64(), msg.ReadFloat());
                    break;

                case ServerCommand.ChampionDied:
                    data = new ChampionDiedEventData(msg.ReadUInt64(),
                                                     msg.ReadUInt64(),
                                                     msg.ReadUInt32(), msg.ReadUInt32(), msg.ReadUInt32(), msg.ReadUInt32(),
                                                     TimeSpan.FromSeconds(msg.ReadUInt16()));
                    break;

                case ServerCommand.StructureStatsChanged:
                    data = new StructureStatsChangedEventData(msg.ReadBoolean() ? Teams.Left : Teams.Right,
                                                              (StructureTypes)msg.ReadByte(),
                                                              msg.ReadFloat());
                    break;

                case ServerCommand.StructureDestroyed:
                    data = new StructureDestroyedEventData(msg.ReadBoolean() ? Teams.Left : Teams.Right,
                                                           (StructureTypes)msg.ReadByte());
                    break;

                case ServerCommand.EndOfGame:
                    data = new EndOfGameEventData(msg.ReadBoolean() ? Teams.Left : Teams.Right);
                    break;

                case ServerCommand.TowerPreparingToShoot:
                    data = new TowerPreparingToShootEventData(msg.ReadBoolean() ? Teams.Left : Teams.Right,
                                                              (StructureTypes)msg.ReadByte());
                    break;

                default:
                    Debug.Fail("Unknown server command when updating (unknown remarkable event)");
                    break;
                }
                if (data != null)
                {
                    RemarkableEvents.Add(data);
                }
            }
        }