コード例 #1
0
ファイル: TargetManager.cs プロジェクト: marshl/Leviathan2
    public void AddTarget( BaseHealth _health )
    {
        #if UNITY_EDITOR
        if ( Network.peerType == NetworkPeerType.Disconnected )
        {
            this.debugTargetMap.Add( this.currentDebugID, _health );
            DebugConsole.Log( "Added target " + this.currentDebugID, _health );
            _health.debugTargetID = this.currentDebugID;
            this.currentDebugID++;
        }
        else
        #endif
        {
            NetworkViewID viewID = _health.GetComponent<NetworkView>().viewID;
            if ( this.targetMap.ContainsKey( viewID ) )
            {
                DebugConsole.Warning( "Target Manager already contains " + viewID
                                     + " (" + this.GetTargetWithID( viewID ).gameObject.name+ ")", _health );
                return;
            }

            DebugConsole.Log( "Adding target " + viewID + " (" + _health.gameObject.name
                             + ") to TargetManager", _health );
            this.targetMap.Add( viewID, _health );
        }

        #if UNITY_EDITOR
        this.debugTargets.Add( _health );
        #endif
    }
コード例 #2
0
ファイル: TargetManager.cs プロジェクト: marshl/Leviathan2
 public void RemoveTarget( BaseHealth _target )
 {
     #if UNITY_EDITOR
     this.debugTargets.Remove( _target );
     if ( Network.peerType == NetworkPeerType.Disconnected )
     {
         this.debugTargetMap.Remove( _target.debugTargetID );
     }
     else
     #endif
     {
         this.targetMap.Remove( _target.GetComponent<NetworkView>().viewID );
     }
 }