public static void SelectBodies()
    {
        if (Application.isPlaying)
        {
            return;
        }
        var temp = Selection.objects;
        //SelectCharacters();
        List <Object> Characters = new List <Object>();

        foreach (var thing in temp)
        {
            BaseCharacterControl tempChar = thing.GetCharacter();
            if (tempChar == null)
            {
                //throw new Exception("Selected something that is not a character");
                continue;
            }
            GameObject tempGO = tempChar.MoveComponent.gameObject;
            if (!Characters.Contains(tempGO))
            {
                Characters.Add(tempGO);
            }
        }
        Selection.objects = Characters.ToArray();
        //SceneView.FrameLastActiveSceneView();
        Tools.current = Tool.Move;
        Debug.Log("Selected bodies of selected characters");
    }
コード例 #2
0
        public override void LogicalLateUpdate()
        {
            BaseCharacterControl vars = _sprayAttack.Holder;

            if (vars.Life.Health > _sprayAttack.MinLifeForDamageToSelf)
            {
                vars.Life.Damage(_sprayAttack, _sprayAttack.DamageToSelf);
            }
            if (!_gotInput)
            {
                _ASM.ChangeToInactive();
                return;
            }
            _sprayAttack.AngleDirection = MyMathlib.AngleRadians(vars.DirectionVector);
            _sprayAttack._audioSourceLoop.transform.position = _sprayAttack.MoveComponent.Position;
            Transform transform = _sprayAttack.transform;

            for (int i = 0; i < transform.childCount; i++)
            {
                if (!transform.GetChild(i).gameObject.activeSelf)
                {
                    transform.GetChild(i).gameObject.SetActive(true);
                }
            }
            _sprayAttack.CheckAndSetParticleNumber(_sprayAttack.NumberOfParticles);
            _gotInput = false;
        }
        public static DialogueComponent SetDialogue(this BaseCharacterControl mainSpeaker, DialogueStruct[][] dialogues, int[,] linkInfo)
        {
            DialogueComponent temp = mainSpeaker.SetDialogue();

            temp.Dialogue = new DialogueGraph(dialogues, linkInfo);
            return(temp);
        }
        public static DialogueComponent SetDialogue(this BaseCharacterControl mainSpeaker, DialogueStruct[] dialogue)
        {
            var temp = mainSpeaker.SetDialogue();

            temp.Dialogue = new DialogueGraph(dialogue);
            return(temp);
        }
        public static DialogueComponent setDialogue(this BaseCharacterControl mainSpeaker, DialogueStruct[][] dialogues, int[,] linkInfo, bool auto, bool StandStill, DialogueComponentBase.DialogueStart startConv, DialogueComponentBase.DialogueRepetition repeat, float radius)
        {
            DialogueComponent temp = mainSpeaker.setDialogue(dialogues, linkInfo, auto, StandStill, startConv, repeat);

            temp.Radius = radius;
            return(temp);
        }
 public DialogueStruct(string dialogue, Mood mood, BaseCharacterControl speaker, Action triggerFunction) : this(dialogue, mood, speaker)
 {
     if (OnNext == null)
     {
         OnNext = new UltEvent();
     }
     OnNext.AddPersistentCall(triggerFunction);
 }
 public void AddMobs(params Component[] newMobs)
 {
     BaseCharacterControl[] characters = new BaseCharacterControl[newMobs.Length];
     for (int i = 0; i < newMobs.Length; ++i)
     {
         characters[i] = newMobs[i].GetCharacter();
     }
     AddMobs(characters);
 }
        public static DialogueComponent setDialogue(this BaseCharacterControl mainSpeaker, DialogueStruct[][] dialogues, int[,] linkInfo, bool auto, bool StandStill, DialogueComponentBase.DialogueStart startConv, DialogueComponentBase.DialogueRepetition repeat)
        {
            DialogueComponent temp = mainSpeaker.SetDialogue(dialogues, linkInfo);

            temp.Auto          = auto;
            temp.Standingstill = StandStill;
            temp.StartConv     = startConv;
            temp.Repeat        = repeat;
            return(temp);
        }
コード例 #9
0
    protected new void Awake()
    {
        base.Awake();
        squire = AddInEditor.MobCreate.SimpleMob(hub.ProportionalPosition(0.1f, -0.5f), playervars.Team.transform, 10f).GetCharacter();
        squire.MoveComponent.enabled = false;


        SetUpSquireGreeting();


        _textStyle = new GUIStyle();
        _textStyle.normal.textColor = Color.black;
        _textStyle.alignment        = TextAnchor.MiddleCenter;
    }
    public static void SetObjectsToRoom(Room room = null)
    {
        if (room == null)
        {
            room = GetOneRoomFromEditorSelection(false);
        }
        List <BaseCharacterControl> characters = new List <BaseCharacterControl>();

        foreach (var thing in Selection.objects)
        {
            BaseCharacterControl tempChar = thing.GetCharacter();
            if (tempChar != null)
            {
                characters.Add(tempChar);
            }
        }
        if (characters.Count == 0)
        {
            throw new Exception("No characters selected");
        }
        Floor floor = MonoBehaviour.FindObjectOfType <Floor>();

        foreach (var character in characters)
        {
            Room tempRoom = floor.GetRoomFromPosition(character.MoveComponent.Position);
            if (tempRoom != null)
            {
                character.MoveComponent.SetPosition(character.MoveComponent.Position - tempRoom.Position + room.Position);
            }
            else
            {
                character.MoveComponent.SetPosition(room.Position);
            }
        }
        List <Object> temp = new List <Object>(Selection.objects);

        temp.RemoveAll(x => (x as GameObject).SearchComponent <Room>() != null);
        Selection.objects = temp.ToArray();
        Debug.Log("moved characters to room", room);
    }
 public virtual void Trigger()
 {
     enabled = true;
     if (Life.IsLifeOfCharacter)
     {
         _character         = this.GetCharacter();
         _character.enabled = false;
         _moveComponent     = _character.MoveComponent;
         _moveComponent.gameObject.SetActive(false);
         _moveComponent.ClearPath();
         transform.position = _moveComponent.Position;
         _rendStart         = _character.Skin[0].Renderer;
         _rend = gameObject.AddComponent <SpriteRenderer>();
         _rend.sortingOrder       = _rendStart.sortingOrder;
         _rend.sprite             = _rendStart.sprite;
         _rend.transform.rotation = _rendStart.transform.rotation;
         _rend.enabled            = true;
     }
     else
     {
         _rend = GetComponent <SpriteRenderer>();
     }
     InitateAnimation();
 }
    private GameObject SpawnNpc(Transform[] fightersgroup)
    {
        GameObject temp    = null;
        int        teamnum = 0;

        for (int i = 0; i < _characters.Length; i++)
        {
            if (_characters[i] == fightersgroup)
            {
                temp    = BasicLib.InstantiatePrefabGmbjct("mobs/npc", MyColorLib.teams[i].transform);
                teamnum = i;
                break;
            }
        }
        LifeComponent        life          = temp.SearchComponent <LifeComponent>();
        AI                   aivars        = temp.SearchComponent <AI>();
        BaseCharacterControl vars          = temp.GetCharacter();
        MoveComponent        MoveComponent = temp.SearchComponent <MoveComponent>();

        //MoveComponent.speed = 10f;

        MoveComponent.SetPosition(_centreSpawns[teamnum] + new Vector3(Random.Range(-10f, 10f), Random.Range(-10f, 10f)));
        aivars.SearchComponent <MoveAround_ChillMode>().CentrePosition = Vector3.zero;

        /*
         * foreach (Transform[] otherteam in fighters)
         * {
         *  if (otherteam != fightersgroup)
         *  {
         *      rules.addToCandoAndToOthers(otherteam, MoveComponent.transform, true, true);
         *  }
         * }
         */

        int rand = Random.Range(0, 5);

        if (rand == 0)
        {
            aivars.AddAttacks(new int[] { WeaponsStaticClass.fire });
            temp.AddComponent <AttackFromDistance_AttackMode>();
        }
        else if (rand == 1)
        {
            aivars.AddAttacks(new int[] { WeaponsStaticClass.ball });
            temp.AddComponent <BallCharge_AttackMode>();
        }
        else if (rand == 2)
        {
            aivars.AddAttacks(new int[] { WeaponsStaticClass.spray });
            temp.AddComponent <AttackFromDistance_AttackMode>();
        }
        else if (rand == 3)
        {
            aivars.AddAttacks(new int[] { WeaponsStaticClass.ball });
            BallChargeAttack ball = temp.SearchComponent <BallChargeAttack>();
            ball.Reach   = 30f;
            ball.MaxSize = 1f;
            ball.Speed   = 60f;
            temp.AddComponent <BallCharge_AttackMode>();
        }
        else if (rand == 4)
        {
            aivars.AddAttacks(WeaponsStaticClass.shield).SearchComponent <Shield>().SetUpAI();
        }
        return(temp);
    }
コード例 #13
0
 public DamagedByInfo(BaseCharacterControl character)
 {
     Character = character;
     Attacks   = new MyLib.MyArrayList <AttackAndDamage>();
 }
コード例 #14
0
 public bool CheckCanTarget(BaseCharacterControl potentialTarget)
 {
     return(CheckIfCanBeTargetedFromTeam(potentialTarget) || (CombineAggroModeAndCanTarget && CanTarget.Contains(potentialTarget, true)));
 }
コード例 #15
0
 public void SetDirectionToTarget(BaseCharacterControl target)
 {
     AICharacter.DirectionVector = ((AICharacter.TargetPosition = target.Position) - AICharacter.Position).normalized;
 }
コード例 #16
0
 public BaseCharacterControl GetClosestOfSeenAllies() => BaseCharacterControl.GetClosestOfSeenAllies(AICharacter);
コード例 #17
0
 public BaseCharacterControl GetClosestOfSeenTargets() => BaseCharacterControl.GetClosestOfSeenTargets(AICharacter);
コード例 #18
0
 protected void Start()
 {
     _character = this.GetCharacter();
     _rend      = GetComponent <SpriteRenderer>();
 }
コード例 #19
0
 public virtual bool HasSeen(BaseCharacterControl target) => HasSeen(target.MoveComponent.GetComponent <CollisionInfo>());
 public DialogueStruct(string dialogue, Mood mood, BaseCharacterControl speaker) : this(dialogue, mood)
 {
     Speaker = speaker;
 }
 private static DialogueComponent SetDialogue(this BaseCharacterControl mainSpeaker)
 {
     return(BasicLib.InstantiatePrefabTr("chatObject", mainSpeaker.MoveComponent.transform).GetComponent <DialogueComponent>());
 }