Ejemplo n.º 1
0
    // important that this is called in Awake (before Start)!
    private void Awake()
    {
        missionBase = GetComponent<MissionBase>();
        if (missionBase == null)
            Debug.Log("ERROR - needs to have a mission attached to template game object!");

        this.chooseTarget = missionBase.HowToChooseTarget;

        DecideHowToChooseTarget();
    }
Ejemplo n.º 2
0
    private void Awake() // important that this is called in Awake (before Start)!
    {
        missionBase = GetComponent <MissionBase>();
        if (missionBase == null)
        {
            Debug.Log("ERROR - needs to have a mission attached to template game object!");
        }

        this.chooseTarget = missionBase.HowToChooseTarget;

        DecideHowToChooseTarget();
    }
Ejemplo n.º 3
0
    // An abstract function has to be overridden while a virtual function may be overridden.
    public virtual void InitializeMission(GameObject player, MissionBase Template)
    {
        if (Template == null)
        {
            Debug.Log("ERROR, Mission Templates have not been assigned for " + player);
        }

        if (Template.TargetPool.Count <= 0)
        {
            Debug.Log("ERROR - Target pool is empty for " + player);
        }

        // Use specific values
        this.Player       = player;
        this.PlayerScript = player.GetComponent <Player>();

        if (PlayerScript == null)
        {
            Debug.Log("ERROR - mission doesn't have link to player! " + this);
        }

        this._missionIsActive = true;

        this.HowToChooseTarget = Template.HowToChooseTarget;

        this.Target = ChooseRandomTarget(Template);

        // Rumble IDs
        if (Target.GetComponent <TargetIDColor>() == null)
        {
            Debug.Log("ERROR  - target for " + gameObject + " doesn't have a TargetIDColor!");
        }
        this.TargetIDColorState = Target.GetComponent <TargetIDColor>().TargetIDColorState;

        // Use template values
        this.MissionType       = Template.MissionType;
        this.Points            = Template.Points;
        this.MissionIDRumble   = Template.MissionIDRumble;
        this.isInstanceMission = true;

        StopAllRumble();

        if (GameManager.Instance.PlayingState != PlayingState.ControllerCalibration && GameManager.Instance.PlayingState != PlayingState.TalkingBeforeControllerCalibration)
        {
            GameObject Particles = (GameObject)Instantiate(GameManager.Instance.MissionInitializedParticles);
            Particles.GetComponent <MissionParticle>().PlayerToFollow = this;
            GameObject ParticlesClone = (GameObject)Instantiate(GameManager.Instance.MissionInitializedParticles);
            Particles.GetComponent <MissionParticle>().SetUpParticleClone(ParticlesClone, this.Player);
        }
        HasHeardMissionRumble = false;

        //Debug.Log(string.Format("Mission {0} initialized for Player {1} with Target {2}", this, this.Player, this.Target.transform.name));

        ThisButtonPressNumberUp   = 0;
        ThisButtonPressNumberDown = 0;
        TimeSinceReceivedMission  = 0;

        HasHeardMissionAtLeastOneTime = false;

        StartCoroutine(WaitForMissionToGetActive());
    }
Ejemplo n.º 4
0
    // An abstract function has to be overridden while a virtual function may be overridden.
    public virtual void InitializeMission(GameObject player, MissionBase Template)
    {
        if (Template == null)
            Debug.Log("ERROR, Mission Templates have not been assigned for " + player);

        if (Template.TargetPool.Count <= 0)
            Debug.Log("ERROR - Target pool is empty for " + player);

        // Use specific values
        this.Player = player;
        this.PlayerScript = player.GetComponent<Player>();

        if (PlayerScript == null)
            Debug.Log("ERROR - mission doesn't have link to player! " + this);

        this._missionIsActive = true;

        this.HowToChooseTarget = Template.HowToChooseTarget;

        this.Target = ChooseRandomTarget(Template);

        // Rumble IDs
        if (Target.GetComponent<TargetIDColor>() == null)
            Debug.Log("ERROR  - target for " + gameObject + " doesn't have a TargetIDColor!");
        this.TargetIDColorState = Target.GetComponent<TargetIDColor>().TargetIDColorState;

        // Use template values
        this.MissionType = Template.MissionType;
        this.Points = Template.Points;
        this.MissionIDRumble = Template.MissionIDRumble;
        this.isInstanceMission = true;

        StopAllRumble();

        if (GameManager.Instance.PlayingState != PlayingState.ControllerCalibration && GameManager.Instance.PlayingState != PlayingState.TalkingBeforeControllerCalibration)
        {
            GameObject Particles = (GameObject)Instantiate(GameManager.Instance.MissionInitializedParticles);
            Particles.GetComponent<MissionParticle>().PlayerToFollow = this;
            GameObject ParticlesClone = (GameObject)Instantiate(GameManager.Instance.MissionInitializedParticles);
            Particles.GetComponent<MissionParticle>().SetUpParticleClone(ParticlesClone, this.Player);
        }
        HasHeardMissionRumble = false;

        //Debug.Log(string.Format("Mission {0} initialized for Player {1} with Target {2}", this, this.Player, this.Target.transform.name));

        ThisButtonPressNumberUp = 0;
        ThisButtonPressNumberDown = 0;
        TimeSinceReceivedMission = 0;

        HasHeardMissionAtLeastOneTime = false;

        StartCoroutine(WaitForMissionToGetActive());
    }