Exemplo n.º 1
0
    void Awake()
    {
        // init text
        txt      = GetComponentInChildren <Text> ();
        txt.text = string.Empty;

        // init controller
        pieceController = GetComponentInParent <PieceController> ();

        // initialize state
        state = PieceState.Empty;

        // init coord
        // (-150, -300) - (-250, -300) = (100, 0)
        // (100, 0) / 100 = (1,0)
        Vector3 coord3 = gameObject.GetComponent <RectTransform>().localPosition - PieceController.pieceZero;

        coord = new Vector2(coord3.x / pieceSize, coord3.y / pieceSize);

        // init ai profile
        aiProfile = new AIProfile();

//		// make sure all coords are correct
//		Debug.Log (string.Format("{0}:{1}:{2}", index, coord, gameObject.GetComponent<RectTransform>().localPosition));
    }
Exemplo n.º 2
0
    protected override void Start()
    {
        base.Start();

        var prefab = m_AIProfiles.GetCurrent().Profiles.SelectRandom();

        m_Profile = Instantiate(prefab, transform);
    }
Exemplo n.º 3
0
    public override void setupCustom()
    {
        type      = Charm.CharmType.StatusEffect;
        className = CharmClass.PatrolStatus;

        patrolProfile = new AIProfile(Owner);
        patrolProfile.setPatrolValues();
    }
    public static void CreateMyAIProfile()
    {
        AIProfile asset = ScriptableObject.CreateInstance <AIProfile>();

        AssetDatabase.CreateAsset(asset, "Assets/AIProfile.asset");
        AssetDatabase.SaveAssets();

        EditorUtility.FocusProjectWindow();

        Selection.activeObject = asset;
    }
Exemplo n.º 5
0
 public CompCharacter(string name, char mapSymbol, int str, long money, PlayerLocation location, Weapon weapon, Stash stash, AIProfile ai)
 {
     Name         = name;
     Symbol       = mapSymbol;
     Location     = location;
     BaseStrength = str;
     Weapon       = weapon;
     Stash        = stash;
     Money        = money;
     AI           = ai;
 }
Exemplo n.º 6
0
    public void setup(GameManager _gm, Board _board, Tile startTile)
    {
        gm      = _gm;
        board   = _board;
        curTile = startTile;

        if (board.isAISim)
        {
            useGO = false;
        }

        health = baseHealth;
        isDead = false;

        canPickUpLoot = false;

        curBehavior = BehaviorMode.Awake;
        if (!isPlayerControlled && !GameManagerTacticsInterface.instance.intoTheBreachMode)
        {
            curBehavior = BehaviorMode.Patrolling;
            addCharm("patrol_status");
        }

        isPodLeader = false;

        //spawn deck
        deck = new Deck();

        for (int i = 0; i < charmIDs.Count; i++)
        {
            addCharm(charmIDs [i]);
        }

        //set them up
        deck.setup(this, deckListPath);

        setHighlighted(false);

        //aiProfile might reference the charms, so we should make it after setting the charms
        aiProfile = new AIProfile(this, aiProfileName);                 //this should load from XML

        //create the game object shell
        if (useGO)
        {
            GameObjectManager.instance.getUnitGO().activate(this);
        }
    }
Exemplo n.º 7
0
    public void SetProfile(AIProfile profile)
    {
        if (!gameObject.activeInHierarchy && m_Profile == null)
        {
            // Defer it
            m_DefaultProfile = profile;
        }
        else
        {
            m_Profile       = profile;
            m_DecisionTimer = 0.0f;

            CharacterMovement movement = GetComponent <CharacterMovement>();
            Debug.Assert(movement != null, "Unable to fetch CharacterMovement");
            movement.ApplySettings(profile);
        }
    }
Exemplo n.º 8
0
    public void StartGameVSIA(AIProfile aiProfile)
    {
        if (GameState != GameState.MainMenu && GameState != GameState.LookingForPlayer)
        {
            return;
        }

        gameMode = GameMode.AI;

        GridManager.Instance.InitForGameStart();

        PlayerManager.Instance.CreateLocalPlayer(BallColor.White, PlayerID.Player1);
        PlayerManager.Instance.CreateAIPlayer(aiProfile, BallColor.Black, PlayerID.Player2);
        GridManager.Instance.SetPawnsStartPosition(BallColor.White, BallColor.White);
        GridManager.Instance.SetPawnsStartPosition(BallColor.Black, BallColor.Black);

        StartGame();

        AudioManager.Instance.PlayAudio(SoundID.ClickUI);
    }
Exemplo n.º 9
0
    public void CreateAIPlayer(AIProfile aiProfile, BallColor color, PlayerID id)
    {
        AIPlayer player = new AIPlayer(aiProfile, color);

        UIManager.Instance.SetPlayer2Name(aiProfile.Name);
        UIManager.Instance.SetPlayer2Pic(aiProfile.Image);

        if (id == PlayerID.Player1)
        {
            player.OnTurnFinished += GridManager.Instance.PlayerTurnEnded;
            players[0]             = player;
            UIManager.Instance.InitPlayer1(color);
        }
        else
        {
            player.OnTurnFinished += GridManager.Instance.PlayerTurnEnded;
            players[1]             = player;
            UIManager.Instance.InitPlayer2(color);
        }
    }
Exemplo n.º 10
0
 public void ApplySettings(AIProfile profile)
 {
     m_MaxSpeedFactor  = profile.m_MaxSpeedFactor;
     m_MoveSpeedFactor = profile.m_MoveSpeedFactor;
 }
Exemplo n.º 11
0
 public void SetAIProfile(AIProfile _aiProfile)
 {
     aiProfile = _aiProfile;
 }
Exemplo n.º 12
0
 public override void setFromParentCustom(Charm parent)
 {
     patrolProfile = ((Charm_PatrolStatus)parent).patrolProfile;
 }
Exemplo n.º 13
0
 public AIPlayer(AIProfile _aiProfile, BallColor color)
     : base(color)
 {
     aiProfile = _aiProfile;
     PlayerManager.Instance.AIBehaviour.SetAIProfile(_aiProfile);
 }
Exemplo n.º 14
0
    public void setAISimUnitFromParent(Unit parent, Board _board, Tile _curTile)
    {
        Profiler.BeginSample("Unit Creation");
        gm      = parent.gm;
        board   = _board;
        curTile = _curTile;

        useGO = false;

        unitName = parent.unitName;
        idName   = parent.idName;

        isActingAIUnit = parent.isActingAIUnit;
        aiProfile      = parent.aiProfile;
        isAISimUnit    = true;

        isPlayerControlled = parent.isPlayerControlled;
        curBehavior        = parent.curBehavior;

        Profiler.BeginSample("making pod list");
        podmates = new List <Unit>();
        foreach (Unit mate in parent.podmates)
        {
            podmates.Add(mate);
        }
        isPodLeader = parent.isPodLeader;
        Profiler.EndSample();

        sprite = null;

        baseHealth = parent.baseHealth;
        health     = parent.health;
        isDead     = parent.isDead;

        challengeLevel = parent.ChallengeLevel;
        canPickUpLoot  = parent.canPickUpLoot;

        baseHandSize = parent.baseHandSize;

        Profiler.BeginSample("making that deck");
        if (!isActingAIUnit)
        {
            Profiler.BeginSample("making null deck");
            deck       = null;
            aiHandSize = parent.aiHandSize;
            if (parent.deck != null)
            {
                aiHandSize = parent.deck.Hand.Count;
            }
            Profiler.EndSample();
        }
        else
        {
            deck = new Deck(parent.deck, this);
        }
        Profiler.EndSample();

        baseActions = parent.baseActions;
        actionsLeft = parent.actionsLeft;

        sightRange = parent.sightRange;

        Profiler.BeginSample("Set charms");
        charms = new List <Charm> ();
        for (int i = 0; i < parent.charms.Count; i++)
        {
            charms.Add(CharmManager.instance.getCharmFromParent(parent.charms[i]));
            //Debug.Log ("test add: " + charms [i].idName + " to " + unitName);
        }
        Profiler.EndSample();

        isHighlighted = parent.isHighlighted;
        highlightCol  = parent.highlightCol;

        aiSimHasBeenAidedCount  = parent.aiSimHasBeenAidedCount;
        aiSimHasBeenCursedCount = parent.aiSimHasBeenCursedCount;

        Profiler.EndSample();
    }