Ejemplo n.º 1
0
 public NormalState( GameObject playerBody )
     : base(playerBody)
 {
     playerMesh = character.GetComponentInChildren<SkinnedMeshRenderer>( );
     playerRig = playerBody.GetComponentInChildren<EntityRig>( );
     character.tag = "Player";
 }
    private void Start()
    {
        // Get the transform of the main camera to allow for camera-relative controls
        if (Camera.main != null)
        {
            cam = Camera.main.transform;
        }
        else
        {
            Debug.LogWarning(
                "Warning: no main camera found. Third person character needs a Camera tagged \"MainCamera\", for camera-relative controls.");
        }

        // Initialize variables
        character = GetComponent<RobotCharacter>();
		ragdoll = GetComponent<RobotRagdoll>();
		particle = GetComponent<RobotParticleManager>();
		energy = GetComponent<RobotEnergy>();
		isoCam = Camera.main.GetComponent<IsometricCamera>();
		GM = GameObject.Find("GameManager").GetComponent<GameManager>();
		gui = GameObject.Find ("GUI").GetComponentInChildren<GUIManager>();
		entity = GetComponentInChildren<EntityRig>();
		crouch = false;
		guard = false;
		leftTriggerReleased = true;
		rightTriggerReleased = true;
		energy.StartEnergyDrain();
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Grab the Entity on the AI, or create one if none exists.  Grab the team Aspect on the AI, or create
    /// one if none exists.  Grab the communication element on the AI, or create one if none exists.  Then
    /// set up the team.
    /// </summary>
    public override void Start()
    {
        base.Start();

        localEntity = AI.Body.GetComponentInChildren<EntityRig>();
        if (localEntity == null)
            localEntity = EntityRig.AddRig(AI.Body);

        teamAspect = localEntity.Entity.GetAspect("team") as TeamAspect;
        if (teamAspect == null)
        {
            teamAspect = new TeamAspect() { AspectName = "team" };
            if (aspectMountPoint != null)
                teamAspect.MountPoint = aspectMountPoint.transform;
            else
                teamAspect.Position += Vector3.up; //move it up off the ground

            localEntity.Entity.AddAspect(teamAspect);
        }

        commElement = AI.GetCustomElement<CommunicationElement>();
        if (commElement == null)
        {
            commElement = new CommunicationElement();
            AI.AddCustomElement(commElement);
        }

        if (string.IsNullOrEmpty(teamCommPrefix))
            teamCommPrefix = cnstDefaultTeamCommPrefix;

        SetTeam(team, true);
    }
Ejemplo n.º 4
0
 void Start()
 {
     entity = GetComponent <EntityRig>();
     SetState(transform.parent.gameObject.activeSelf);
 }
Ejemplo n.º 5
0
 void Start()
 {
     us     = transform.parent.GetComponent <UnitSelected>();
     entity = GetComponent <EntityRig>();
 }