Example #1
0
    public void Initialise( BulletDescriptor _desc )
    {
        this.bulletDesc = _desc;
        this.buckets = new Dictionary<int, LocalBulletBucket>();

        if ( Network.peerType == NetworkPeerType.Disconnected )
        {
            this.CreateBucket( -1 );
        }
        else
        {
            this.CreateBucket( Common.MyNetworkID() );
        }
    }
Example #2
0
    public void Initialise( BulletDescriptor _desc, bool _networked )
    {
        this.bulletDesc = _desc;
        this.networked = _networked;

        if ( this.bulletDesc.count <= 0 )
        {
            DebugConsole.Error( "Bullet list for " + this.bulletDesc + " has unusable count of " + this.bulletDesc.count, this.bulletDesc );
        }
        this.bulletList = new BulletBase[ this.bulletDesc.count ];
        this.bulletDesc.prefab.GetComponent<BulletBase>().weaponType = this.bulletDesc.weaponType;

        for ( int i = 0; i < this.bulletDesc.count; ++i )
        {
            BulletBase bulletScript = this.CreateNewBullet( i );
            this.bulletList[i] = bulletScript;
        }

        this.currentIndex = Random.Range( 0, this.bulletDesc.count );
    }
Example #3
0
 protected virtual void Awake()
 {
     this.desc = BulletDescriptorManager.instance.GetDescOfType( this.weaponType );
 }
Example #4
0
    private void CreateBulletBucket( BulletDescriptor _desc )
    {
        if ( this.bulletDictionary.ContainsKey( _desc.weaponType ) )
        {
            DebugConsole.Error( "Bullet type \"" + _desc.weaponType + "\" already used.", _desc.prefab );
            return;
        }

        GameObject bucketObj = new GameObject();
        bucketObj.name = _desc.weaponType + "Bucket";
        bucketObj.transform.parent = this.transform;

        LocalBulletBucket bulletBucket = bucketObj.AddComponent<LocalBulletBucket>();
        bulletBucket.Initialise( _desc, false );
        this.bulletDictionary.Add ( _desc.weaponType, bulletBucket );
    }