public override bool IsAlly(BaseCharacterEntity characterEntity)
        {
            if (characterEntity == null)
            {
                return(false);
            }

            if (IsSummoned)
            {
                // If summoned by someone, will have same allies with summoner
                return(characterEntity == Summoner || characterEntity.IsAlly(Summoner));
            }
            if (characterEntity is BaseMonsterCharacterEntity)
            {
                // If another monster has same allyId so it is ally
                var monsterCharacterEntity = characterEntity as BaseMonsterCharacterEntity;
                if (monsterCharacterEntity != null)
                {
                    if (monsterCharacterEntity.IsSummoned)
                    {
                        return(IsAlly(monsterCharacterEntity.Summoner));
                    }
                    return(monsterCharacterEntity.MonsterDatabase.allyId == MonsterDatabase.allyId);
                }
            }
            return(false);
        }
Beispiel #2
0
 public bool TryGetAttackingCharacter(out BaseCharacterEntity character)
 {
     character = null;
     if (PlayerCharacterEntity.TryGetTargetEntity(out character))
     {
         if (character != PlayerCharacterEntity && !character.IsAlly(PlayerCharacterEntity))
         {
             return(true);
         }
         else
         {
             character = null;
         }
     }
     return(false);
 }
Beispiel #3
0
 public bool TryGetSelectedTargetAsAttackingCharacter(out BaseCharacterEntity character)
 {
     character = null;
     if (SelectedEntity != null)
     {
         character = SelectedEntity as BaseCharacterEntity;
         if (character != null &&
             !character.IsAlly(PlayerCharacterEntity))
         {
             return(true);
         }
         else
         {
             character = null;
         }
     }
     return(false);
 }
Beispiel #4
0
        private void Update()
        {
            if (characterEntity == null || BasePlayerCharacterController.OwningCharacter == null)
            {
                if (owningIndicator != null)
                {
                    owningIndicator.SetActive(false);
                }
                if (allyIndicator != null)
                {
                    allyIndicator.SetActive(false);
                }
                if (enemyIndicator != null)
                {
                    enemyIndicator.SetActive(false);
                }
                if (neutralIndicator != null)
                {
                    neutralIndicator.SetActive(false);
                }
                return;
            }

            if (Time.unscaledTime - lastUpdateTime >= updateRepeatRate)
            {
                lastUpdateTime = Time.unscaledTime;
                if (owningIndicator != null)
                {
                    owningIndicator.SetActive(false);
                }
                if (allyIndicator != null)
                {
                    allyIndicator.SetActive(false);
                }
                if (enemyIndicator != null)
                {
                    enemyIndicator.SetActive(false);
                }
                if (neutralIndicator != null)
                {
                    neutralIndicator.SetActive(false);
                }
                if (BasePlayerCharacterController.OwningCharacter == characterEntity)
                {
                    if (owningIndicator != null)
                    {
                        owningIndicator.SetActive(true);
                    }
                }
                if (characterEntity.IsAlly(BasePlayerCharacterController.OwningCharacter))
                {
                    if (allyIndicator != null)
                    {
                        allyIndicator.SetActive(true);
                    }
                }
                if (characterEntity.IsEnemy(BasePlayerCharacterController.OwningCharacter))
                {
                    if (enemyIndicator != null)
                    {
                        enemyIndicator.SetActive(true);
                    }
                }
                if (characterEntity.IsNeutral(BasePlayerCharacterController.OwningCharacter))
                {
                    if (neutralIndicator != null)
                    {
                        neutralIndicator.SetActive(true);
                    }
                }
            }
        }
Beispiel #5
0
        private void Update()
        {
            if (characterEntity == null ||
                BasePlayerCharacterController.OwningCharacter == null ||
                Vector3.Distance(characterEntity.CacheTransform.position, BasePlayerCharacterController.OwningCharacter.CacheTransform.position) > updateWithinRange)
            {
                if (owningIndicator != null && owningIndicator.activeSelf)
                {
                    owningIndicator.SetActive(false);
                }
                if (allyIndicator != null && allyIndicator.activeSelf)
                {
                    allyIndicator.SetActive(false);
                }
                if (enemyIndicator != null && enemyIndicator.activeSelf)
                {
                    enemyIndicator.SetActive(false);
                }
                if (neutralIndicator != null && neutralIndicator.activeSelf)
                {
                    neutralIndicator.SetActive(false);
                }
                return;
            }

            if (Time.unscaledTime - lastUpdateTime >= updateRepeatRate)
            {
                lastUpdateTime = Time.unscaledTime;

                tempVisibleResult = BasePlayerCharacterController.OwningCharacter == characterEntity;
                if (owningIndicator != null && owningIndicator.activeSelf != tempVisibleResult)
                {
                    owningIndicator.SetActive(tempVisibleResult);
                }

                if (tempVisibleResult)
                {
                    return;
                }

                tempVisibleResult = characterEntity.IsAlly(BasePlayerCharacterController.OwningCharacter);
                if (allyIndicator != null && allyIndicator.activeSelf != tempVisibleResult)
                {
                    allyIndicator.SetActive(tempVisibleResult);
                }

                if (tempVisibleResult)
                {
                    return;
                }

                tempVisibleResult = characterEntity.IsEnemy(BasePlayerCharacterController.OwningCharacter);
                if (enemyIndicator != null && enemyIndicator.activeSelf != tempVisibleResult)
                {
                    enemyIndicator.SetActive(tempVisibleResult);
                }

                if (tempVisibleResult)
                {
                    return;
                }

                tempVisibleResult = characterEntity.IsNeutral(BasePlayerCharacterController.OwningCharacter);
                if (neutralIndicator != null && neutralIndicator.activeSelf != tempVisibleResult)
                {
                    neutralIndicator.SetActive(tempVisibleResult);
                }
            }
        }