Changeset 6313 for 2014/30


Ignore:
Timestamp:
2015-06-25 09:42:56 (8 years ago)
Author:
anlakane
Message:
 
Location:
2014/30/MitjaK/Attack to Agora/Attack to Agora/Attack to Agora
Files:
10 added
9 edited

Legend:

Unmodified
Added
Removed
  • 2014/30/MitjaK/Attack to Agora/Attack to Agora/Attack to Agora/Attack to Agora/Attack to Agora.csproj

    r6139 r6313  
    111111  </ItemGroup> 
    112112  <ItemGroup> 
     113    <Compile Include="Attack_to_Agora_mitja.cs" /> 
     114    <Compile Include="ChromaCase.cs" /> 
     115    <Compile Include="Attack_to_Agora_pyry.cs" /> 
     116    <Compile Include="ItemType.cs" /> 
    113117    <Compile Include="Ohjelma.cs" /> 
    114118    <Compile Include="Attack_to_Agora.cs" /> 
  • 2014/30/MitjaK/Attack to Agora/Attack to Agora/Attack to Agora/Attack to Agora/Attack_to_Agora.cs

    r6312 r6313  
    2020    Image level1 = LoadImage("kentta1"); 
    2121    Image taistelijanvarjo = LoadImage("varjo"); 
    22  
    2322    Image taistelijaOlio = LoadImage("olio"); 
     23    Image cCaseD = LoadImage("laatikko_opening"); 
     24    Image cCaseF = LoadImage("caseavausruutu"); 
     25 
    2426    PlatformCharacter taistelija; 
    2527 
     
    197199 
    198200        List<GameObject> pItems = new List<GameObject>(); 
    199  
    200         for (int i = 0; i < 40; i++) 
    201         { 
    202             GameObject obj = new GameObject(50, 50); 
    203             obj.Color = RandomGen.NextColor(); 
    204             obj.Tag = 50.0; 
    205             pItems.Add(obj); 
    206         } 
    207  
    208         GameObject cCaseDialog = new GameObject(LoadImage("laatikko_opening")); // koko debug 
     201        GameObject knife = new GameObject(LoadImage("rareitem_knife")); 
     202        knife.Tag = new object[2] {(object)50.0, (object)ItemType.Knife}; 
     203        pItems.Add(knife); 
     204 
     205        GameObject avain = new GameObject(LoadImage("rareitem_avain_small")); 
     206        avain.Tag = new object[2] { (object)50.0, (object)ItemType.Key }; 
     207        pItems.Add(avain); 
     208         
     209 
     210        //for (int i = 0; i < 40; i++) 
     211        //{ 
     212        //    GameObject obj = new GameObject(50, 50); 
     213        //    obj.Color = RandomGen.NextColor(); 
     214        //    obj.Tag = 50.0; 
     215        //    pItems.Add(obj); 
     216        //} 
     217 
     218        GameObject cCaseDialog = new GameObject(cCaseD); // koko debug 
    209219        Add(cCaseDialog); 
    210220 
     
    213223            cCaseDialog.Destroy(); 
    214224 
    215             GameObject cCaseFront = new GameObject(LoadImage("caseavausruutu")); 
     225            GameObject cCaseFront = new GameObject(cCaseF); 
    216226 
    217227            ChromaCase cCase = new ChromaCase(pItems, cCaseFront, null, 20); 
    218228            cCase.Add(new Vector(0.0, Level.Bottom + cCaseFront.Height / 2), 2); 
    219             cCase.ItemReceived += GotItemFromCase; 
    220             //cCase.ItemRelativePosition = new Vector(47 
     229            cCase.ItemReceived += delegate(GameObject o) { GotItemFromCase(o); }; 
     230            cCase.ItemRelativePosition = new Vector((472 - 467.5), (455 - 204)); 
    221231            cCase.Start(); 
    222232 
     
    226236    void GotItemFromCase(GameObject o) 
    227237    { 
    228          
     238        ItemType gotType = (ItemType)((object[])o.Tag)[0]; 
     239 
     240        switch (gotType) 
     241        { 
     242            case ItemType.Knife: 
     243                break; 
     244            case ItemType.Key: 
     245                break; 
     246            default: 
     247                break; 
     248        } 
    229249    } 
    230250 
  • 2014/30/MitjaK/Attack to Agora/Attack to Agora/Attack to Agora/Attack to Agora/ChromaCase.cs

    r6276 r6313  
    88{ 
    99    public GameObject OpeningScreenFront; 
    10     private Vector ShownItemPosition = Vector.Zero; 
    1110    private int CurrentItem = 0; 
    1211    public int Items; 
     
    3130    /// <summary> 
    3231    /// Luo ChromaCase-olion. Lisää olio ruudulle Add-metodilla. 
    33     /// Todennäköisyydet ovat esineiden tageissa doublena mielivaltaisella välillä, 
     32    /// Todennäköisyydet ovat esineiden tageissa object-taulukossa[0] doublena mielivaltaisella välillä, 
    3433    /// esim 0.0 - 100.0 
    3534    /// </summary> 
     
    110109        } 
    111110 
    112         ShownItems[CurrentItem].Position = ShownItemPosition; 
     111        ShownItems[CurrentItem].Position = this.Position + ItemRelativePosition; 
    113112        if (layer > -3) 
    114113            Game.Instance.Add(ShownItems[CurrentItem], layer - 1); 
     
    155154        for (int i = 0; i < PossibleItems.Count; i++) 
    156155        { 
    157             double current = (double)PossibleItems[i].Tag; 
     156            double current = (double)(((object[])PossibleItems[i].Tag)[0]); 
    158157            total += current; 
    159158 
Note: See TracChangeset for help on using the changeset viewer.