Example #1
0
    public override void Initialize()
    {
        //load aim target and look target
        GameObject aimTarget  = (GameObject)GameObject.Instantiate(Resources.Load("IKAimTargetRoot"));
        GameObject lookTarget = (GameObject)GameObject.Instantiate(Resources.Load("IKLookTarget"));

        AimTargetRoot = aimTarget.transform;
        AimTarget     = AimTargetRoot.Find("IKAimTarget").transform;
        LookTarget    = lookTarget.transform;


        LoadCharacterModel(this.CharacterID);



        this.MyEventHandler = GetComponent <CharacterEventHandler>();

        this.Destination = transform.position;
        MyNavAgent       = GetComponent <UnityEngine.AI.NavMeshAgent>();
        UpperBodyState   = MutantUpperBodyStates.Idle;
        ActionState      = HumanActionStates.None;


        this.MyStatus = GetComponent <CharacterStatus>();
        this.MyStatus.ParentCharacter = this;
        //this.MyStatus.Initialize();


        this.MyStatus.RunSpeedModifier = 1f;

        this.Stealth = new CharacterStealth(this);

        this.Inventory      = new CharacterInventory();
        this.CharacterAudio = GetComponent <AudioSource>();

        //each time a human char is initialized it's added to NPC manager's list of human characters to keep track of
        GameManager.Inst.NPCManager.AddMutantCharacter(this);

        CurrentAnimState = new MutantAnimStateIdle(this);
        //SendCommand(CharacterCommands.Unarm);

        this.GoapID = this.MyReference.GoapID;
        MyAI        = GetComponent <AI>();
        MyAI.Initialize(this);

        this.ArmorSystem = new ArmorSystem(this);

        _meleeStrikeStage = 0;
    }