示例#1
0
    public bool addNewMissile(GameObject missile,missileType mType)
    {
        switch(mType)
        {
            case(missileType.Homing):
                if(homingMissileObject != null)
                {
                    return false;
                }

                homingMissileObject = missile;
                mC = homingMissileObject.GetComponentInChildren<homingMissileCamera>();
                mC.tLC = this;
                return true;
            case(missileType.Controlled):
                if(controlledMissileOjbect != null)
                {
                    return false;
                }

                controlledMissileOjbect = missile;
                //TODO Arlen:  replace this getcomponent with the correct information
                contMisScript = missile.GetComponentInChildren<ControlledMissile>();
                contMisScript.tLC = this;
                return true;
            default:
            return false;
        }
    }
示例#2
0
    public bool addNewMissile(GameObject missile, missileType mType)
    {
        switch (mType) {
        case(missileType.Homing):
            if (homingMissileObject != null) {
                return false;
            }

            homingMissileObject = missile;
            navPoint homingNav = homingMissileObject.GetComponentInChildren<navPoint> ();
            homingNav.playerColor = playerColor;
            homingNav.nameTag = nameTag;
            homingNav.refresh();
            mC = homingMissileObject.GetComponentInChildren<homingMissileScript> ();
            mC.tLC = this;
            return true;
        case(missileType.Controlled):
            if (controlledMissileOjbect != null) {
                return false;
            }

            controlledMissileOjbect = missile;
            navPoint contNav = controlledMissileOjbect.GetComponentInChildren<navPoint> ();
            contNav.playerColor = playerColor;
            contNav.nameTag = nameTag;
            contNav.refresh ();
            contMisScript = missile.GetComponentInChildren<ControlledMissile> ();
            contMisScript.tLC = this;
            return true;
        case(missileType.Collector):
            Debug.Log("Received fire command");
            if(ResourceMissile != null) {
                return false;
            }
            Debug.Log("Setting up AI missile");
            ResourceMissile = missile;
            navPoint rescontNav = ResourceMissile.GetComponentInChildren<navPoint>();
            rescontNav.playerColor = playerColor;
            rescontNav.nameTag = nameTag;
            rescontNav.refresh();
            resourceMissileScript = missile.GetComponentInChildren<resourceRobot>();
            resourceMissileScript.tLC = this;
            Debug.Log("Returning true");
            return true;
        case(missileType.DefenseSystem):
            if(DefenseSystem != null){
                return false;
            }
            DefenseSystem = missile;
            DefenseSystemScript = missile.GetComponentInChildren<defensesystem>();
            DefenseSystemScript.tLC = this;
            return true;
        default:
            return false;
        }
    }