// Use this for initialization void Start() { movementActuator = this.GetComponentInParent <CharacterMovementActuator>() as CharacterMovementActuator; contactSensor = this.GetComponentInParent <CharacterContactSensor>() as CharacterContactSensor; aimingController = this.GetComponent <AimingController>() as AimingController; firingController = this.GetComponent <FiringController>() as FiringController; itemManager = this.GetComponent <ItemManager> () as ItemManager; }
// Use this for initialization void Start() { aimingController = this.transform.parent.GetComponentInChildren <AimingController> () as AimingController; contactSensor = this.transform.GetComponentInParent <CharacterContactSensor> () as CharacterContactSensor; itemManager = this.transform.parent.GetComponentInChildren <ItemManager> () as ItemManager; handSprite = GetComponent <SpriteRenderer>(); movementActuator = GetComponentInParent <CharacterMovementActuator> () as CharacterMovementActuator; MatchArmMaterialToCharacter(); }
public CharacterComponentData(Character C) { character = C; aimingController = C.GetComponentInChildren <AimingController> () as AimingController; firingController = C.GetComponentInChildren <FiringController> () as FiringController; movementController = C.GetComponentInChildren <MovementController> () as MovementController; movementActuator = C.GetComponent <CharacterMovementActuator> () as CharacterMovementActuator; itemManager = C.GetComponentInChildren <ItemManager>() as ItemManager; corpus = C.GetComponent <CharacterCorpus> () as CharacterCorpus; characterTransform = movementActuator.transform; }
// Use this for initialization void Start() { animator = GetComponent <Animator>(); spriteRenderer = GetComponent <SpriteRenderer>(); characterMovement = this.transform.parent.GetComponent <CharacterMovementActuator>() as CharacterMovementActuator; characterContacts = this.transform.parent.GetComponent <CharacterContactSensor>() as CharacterContactSensor; aimingController = this.transform.parent.FindChild("ActionControllers").GetComponent <AimingController>() as AimingController; corpus = GetComponentInParent <CharacterCorpus> () as CharacterCorpus; hand = this.transform.parent.GetComponentInChildren <Hand> () as Hand; defaultColor = spriteRenderer.color; }
void Start() { horizontalAiming = 0; verticalAiming = 0; horizontalInput = 0; verticalInput = 0; isAiming = false; isWallAdjacent = false; wallSide = MovementDirection.NEUTRAL; firingController = GetComponent <FiringController> () as FiringController; characterContact = this.transform.parent.GetComponent <CharacterContactSensor>() as CharacterContactSensor; movementActuator = GetComponentInParent <CharacterMovementActuator> () as CharacterMovementActuator; }
// Use this for initialization void Start() { firingController = this.transform.parent.GetComponentInChildren <FiringController> () as FiringController; aimingController = this.transform.parent.GetComponentInChildren <AimingController>() as AimingController; movementActuator = GetComponentInParent <CharacterMovementActuator> () as CharacterMovementActuator; character = GetComponentInParent <Character> () as Character; hand = this.transform.parent.GetComponentInChildren <Hand> () as Hand; componentData = new CharacterComponentData(character); itemWheel = GetComponentInChildren <ItemWheel> () as ItemWheel; instantiatedDefault = Instantiate(defaultItemPrefab, this.transform.position, Quaternion.identity) as Item; instantiatedDefault.SetItemStateHeld(); EquipItem(instantiatedDefault); inventory = new List <Item>(); AddItemToInventory(instantiatedDefault); }
private void Start() { _transform = transform; ICommandProvider commandProvider = _isHumanControlled ? ActivateHumanControl() : ActivateAgentControl(); Animator animator = GetComponentInChildren <Animator>(); _idleStateTrigger = new CharacterIdleStateTrigger(commandProvider, animator); _movingStateTrigger = new CharacterMovingStateTrigger(commandProvider); _attackingStateTrigger = new CharacterAttackingStateTrigger(commandProvider); _movementActuator = new CharacterMovementActuator(transform, GetComponent <Rigidbody>(), GetComponent <AgentNavigator>(), GetComponent <IAgentAI>(), GetComponent <SwampCollisionListener>(), commandProvider, _configuration); _animationActuator = new CharacterAnimationActuator(animator); _currentState = CharacterState.Idle; FindObjectOfType <TargetOrchestrator>().RegisterBeacon(this); }
protected void ResolveCollision(GameObject other) { CharacterCorpus corpus = other.GetComponent <CharacterCorpus> () as CharacterCorpus; Character character = other.GetComponent <Character> () as Character; if (corpus != null) { if (character != null) { if (character != this.componentData.GetCharacter()) { if (bounceCasterOnHit) { CharacterMovementActuator castingAcuator = componentData.GetMovementActuator(); if (castingAcuator != null) { if (castingAcuator.GetVerticalSpeed() < -1f) { if (castingAcuator.transform.position.y > corpus.transform.position.y) { castingAcuator.BounceCommand(16f); corpus.TakeDamage(damage, firingTeam); corpus.TakeKnockback(worldLaunchVector, knockbackSpeed); } } } } else { corpus.TakeDamage(damage, firingTeam); corpus.TakeKnockback(worldLaunchVector, knockbackSpeed); } if (destroyOnCharacterContact) { DestroyProjectile(); } } } } if (other.gameObject.layer == 8) //If other is terrain { if (destroyOnTerrainContact) { DestroyProjectile(); } } if (deflectsProjectiles) { if (other.gameObject.layer == 13) //If other is a projectile(ranged) { Rigidbody body = other.GetComponent <Rigidbody>() as Rigidbody; if (body != null) { Transform castingTransform = componentData.GetCharacterTransform(); if (castingTransform != null) { Vector3 toOtherProj = other.transform.position - castingTransform.position; toOtherProj.Normalize(); float otherProjSpeed = body.velocity.magnitude; body.velocity = otherProjSpeed * toOtherProj; } } } } }
// Use this for initialization void Start() { movementActuator = GetComponentInParent <CharacterMovementActuator> () as CharacterMovementActuator; aimingController = this.transform.parent.GetComponentInChildren <AimingController> () as AimingController; homePosition = this.transform.position; }
void Start() { body = GetComponent <Rigidbody>() as Rigidbody; heartBank = GetComponent <HeartBank> () as HeartBank; movementActuator = GetComponent <CharacterMovementActuator> () as CharacterMovementActuator; }