コード例 #1
0
ファイル: Health.cs プロジェクト: rkoning/UnityNetworking
    public void ApplyStatus(StatusFactory factory, BaseAvatar source)
    {
        if (currentEffects.Contains(factory))
        {
            return;
        }
        Status s = factory.GetStatus(this, source);

        currentEffects.Add(factory);
        s.OnUnapply += () => {
            Debug.Log("OnUnapply");
            currentEffects.Remove(factory);
            OnStatusRemoved(s);
        };
        s.Apply();
        OnStatusApplied(s);
    }
コード例 #2
0
 void OnEvent(PlayerRespawnEvent eventArgs)
 {
     if (Occupied || eventArgs.Consumed)
     {
         return;
     }
     eventArgs.Consumed = true;
     //TODO(james7132): Fix this
     _character = eventArgs.Player.PlayerObject.GetComponentInChildren <Character>();
     _character.Movement.RpcMove(transform.position);
     _character.ResetCharacter();
     _invincibility = Status.Apply <Invincibility>(_character, _invicibilityTimer + _platformTimer);
     _timer         = 0f;
     eventArgs.Player.PlayerObject.SetActive(true);
     Occupied    = true;
     _isOccupied = true;
 }
コード例 #3
0
    /**
     * Private methods
     */
    public void ApplyStatus(GameObject projectile, Status status)
    {
        Type   type           = status.GetType();
        Status alreadyApplied = gameObject.GetComponent(type) as Status;

        // New Status to apply
        if (!alreadyApplied)
        {
            Status appliedStatus = gameObject.AddComponent(type) as Status;
            appliedStatus.Copy(status);
            appliedStatus.Apply(gameObject, projectile);
        }

        // Status currently applied
        else
        {
            alreadyApplied.Refresh();
            alreadyApplied.Apply(gameObject, projectile);
        }
    }
コード例 #4
0
ファイル: Character.cs プロジェクト: ejasan0502/PlantKitty
        public void AddStatus(Character caster, string status)
        {
            if (statuses == null)
            {
                statuses = new List <Status>();
            }

            Status st = GameData.Instance.GetStatus(status);

            if (st.name != "" || HasStatus(status))
            {
                return;
            }

            st.SetCaster(caster);
            statuses.Add(st);

            if (!st.continuous)
            {
                st.Apply(this);
            }
        }
コード例 #5
0
 public new void Apply(Status status)
 {
     status.Apply(DeliveryPack);
     base.Apply(status);
 }